for (int x = 0; x < openSlots; x++) {
    NSLog(@"Loading slot %i.", (x+1)); 
    [[valueEditorSlots objectAtIndex:x] setStringValue:[[valueSavesDictionary valueForKey:[NSString stringWithFormat:@"Value Slot %i", (x+1)]] stringValue]];
    [[valueSlots objectAtIndex:x] setStringValue:[[valueSavesDictionary valueForKey:[NSString stringWithFormat:@"Value Slot %i", (x+1)]] stringValue]];        
    [[slotValues objectAtIndex:x] setIntValue:[[valueSavesDictionary valueForKey:[NSString stringWithFormat:@"Slot Value %i", (x+1)]] intValue]];
}
.

Hello,我正在尝试从属性列表中读取一组字符串和数字。NSNMutableArray载有所有变量名称(索引0-8)。因此,我遍历数组的每个成员(所有这些都是UI TextFields),并将字符串值设置为其对应的属性列表键(Value Slot#)。这不起作用。我在调试器中收到以下错误消息:

- [__ nscfstring stringvalue]:无法识别选择器发送到实例0x100463110

谢谢

有帮助吗?

解决方案

您在第3行和4中调用stringValue。它们已经是字符串,所以这是不必要的。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top