简体   繁体   English

__NSCFConstantString objectForKey无法识别的选择器发送到实例错误

[英]__NSCFConstantString objectForKey unrecognized selector sent to instance error

I basically get this error 我基本上得到这个错误

'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x581f0'

on my program. 在我的程序上。 I think it refers to this call I make, 我认为这是指我打的这个电话,

if (data != nil) {
    if([data objectForKey:@"username"]){
       // NSArray *check= [[NSArray alloc]init];
        //check=[data allValues];
        [dict setObject:[data allValues] forKey:@"args"];

    }else{
    [dict setObject:[NSArray arrayWithObject:data] forKey:@"args"];
}

at the setObject:[data allValues]. 在setObject:[data allValues]。 I don't know why it gives that error but data is an NSDictionary and I'm getting all the values and placing it in an array. 我不知道为什么会出现该错误,但是数据是一个NSDictionary,我正在获取所有值并将其放置在数组中。

Is the error happening here: 错误发生在这里:

    if([data objectForKey:@"username"]){

I assume so, as that is the only place objectForKey seems to be called. 我认为是这样,因为这似乎是唯一调用objectForKey的地方。 You are calling it on a variable called 'data', which i'm guessing simply is not a dictionary. 您在名为“数据”的变量上调用它,我猜这根本不是字典。 You should NSLog its type to see. 您应该使用NSLog的类型来查看。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NSInvalidArgumentException”,原因:“-[__ NSCFConstantString objectForKey:]:无法识别的选择器已发送到实例0x10256a1b0” - NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x10256a1b0' - [__ NSCFConstantString size]:无法识别的选择器发送到实例......? - -[__NSCFConstantString size]: unrecognized selector sent to instance …? NSCFConstantString objectAtIndex无法识别的选择器已发送到实例 - NSCFConstantString objectAtIndex unrecognized selector sent to instance __NSCFConstantString objectAtIndex:]:无法识别的选择器已发送到实例 - __NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance CollectionView [__NSCFConstantString _isResizable]:无法识别的选择器已发送到实例 - CollectionView [__NSCFConstantString _isResizable]: unrecognized selector sent to instance 错误:[__ NSCFConstantString路径]:无法识别的选择器已发送 - Error: [__NSCFConstantString path]: unrecognized selector sent - [__ NSArrayM objectForKey:]:无法识别的选择器发送到目标c中的实例错误 - -[__NSArrayM objectForKey:]: unrecognized selector sent to instance Error in Objective c 错误:[事件objectForKey:]:无法识别的选择器已发送到实例0x - An error: [Events objectForKey:]: unrecognized selector sent to instance 0x 'NSInvalidArgumentException',原因:'-[__ NSCFConstantString addObject:]:无法识别的选择器已发送到实例 - 'NSInvalidArgumentException', reason: '-[__NSCFConstantString addObject:]: unrecognized selector sent to instance UIActivityViewController崩溃,NSCFConstantString _beforeActivity无法识别的选择器发送到实例 - UIActivityViewController crashing, NSCFConstantString _beforeActivity unrecognized selector sent to instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM