NSInvocationOperation problem with a signal exc_bad_access
NSInvocationOperation problem with a signal exc_bad_access
- Subject: NSInvocationOperation problem with a signal exc_bad_access
- From: ico <email@hidden>
- Date: Tue, 21 Sep 2010 00:06:40 +0800
Hi All,
I have a test program which is "command line tool" type when I created the
project.
I also have added a class into this project, called DemoPoint.
My main function showed as follow:
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// perform some test codes;
DemoPoint *dp = [[DemoPoint alloc] init];
[dp display];
// so far so good
// receive signal exc_bad_access when the program execute the next
statment
NSInvocationOperation *theOp = [[[NSInvocationOperation alloc]
initWithTarget:dp selector:@selector(massiveWork:) object:nil] autorelease];
[dp release];
[pool drain];
return 0;
}
here is the massiveWork method in DemoPoint class:
- (void) massiveWork {
int count = 0;
for (int i = 0; i < 1000; i++) {
count += 2;
}
NSLog(@"massive work done!");
}
can someone tell me what problem is, NSInvocationOperation allocation is
even failed, I guess it maybe a simple problem
but I am just new to Objective-C, so please help, thanks.
--
==========================
Life isn't about finding yourself.
Life is about creating yourself.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden