【发布时间】:2012-11-21 08:48:35
【问题描述】:
NSString *Address = [placemark.addressDictionary objectForKey:@"FormattedAddressLines"];
NSLog(@"Address:%@", Address);
Address: ("Hooker Alley","San Francisco, CA 94108",USA)
我想从地址字符串中删除一些字符,例如 Hooker Alley, San Francisco, CA 94108,USA。 怎么去掉这样的?请帮帮我
提前致谢
我试过了:
NSString *removeCharacter = [Address stringByReplacingOccurrencesOfString:@"(" withString:@""];
但错误出现在 First throw 调用堆栈中:
错误信息是,
-[__NSArrayM stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x81afd00
【问题讨论】:
-
确切的错误是什么?请尝试使用“地址”而不是“地址”作为变量名。它与类名和数据类型名非常混淆。
-
-[__NSArrayM stringByReplacingOccurrencesOfString:withString:]:无法识别的选择器发送到实例 0x81afd00
-
你的地址变量返回一个数组
-
这意味着“地址”不是字符串,而是返回一个数组。
标签: iphone objective-c ios replace nsstring