开发者

NSString assignment issue? Error adding object to NSArray

I'm g开发者_如何学编程etting the following error when I run my application in XCode:

2011-06-05 16:28:53.957 QueryTesting[9452:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString addObject:]: unrecognized selector sent to instance 0x170fd0'

The problem highlights the second line below:

NSString *facebookID = [NSString stringWithFormat:@"1222740351"];
[propertyValues addObject:facebookID];

Is there a problem with facebookID initializing?

EDIT: propertyValues is a NSMutableArray and has been initialized here:

NSMutableArray *propertyValues = [[NSMutableString alloc] init];


propertyValues is defined as an NSString object but should be either an NSMutableArray object or NSMutableSet object, or any other object responding to an addObject:-message.

Another possibility is mem corruption or you understood memory management wrong. In that case: read the memory management programming guide and enable the Clang Static Analyser!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜