【发布时间】:2012-10-30 23:26:10
【问题描述】:
我正在尝试像这样创建一个 NSMutableURLRequest:
NSURL *URLWithString = [
NSString stringWithFormat:@"%@?%@",
urlString,
datas
];
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:URLWithString] autorelease];
当我在我的 iPhone 4S 上运行它时,应用程序崩溃并出现以下异常:
2012-10-30 15:58:53.495 [429:907] -[__NSCFString absoluteURL]: 无法识别的选择器发送到实例 0x1cd74a90
2012-10-30 15:58:53.497 [429:907] --- 由于未捕获而终止应用程序 异常'NSInvalidArgumentException',原因:'-[__NSCFString absoluteURL]: 无法识别的选择器发送到实例 0x1cd74a90'
--- 首先抛出调用栈:
(0x361b62a3 0x344c697f 0x361b9e07 0x361b8531 0x3610ff68 0x3611363f 0x320396e7 0x32039551 0x320394ed 0x33bde661 0x33bde597 0x387e1 0x376d9f1f 0x376da9a9 0x341c535d 0x3618b173 0x3618b117 0x36189f99 0x360fcebd 0x360fcd49 0x366392eb 0x374db301 0x37cc1 0x37c58)
libc++abi.dylib:终止调用抛出异常
怎么了?
【问题讨论】:
-
您是否在其他代码中调用
absoluteURL?崩溃告诉您您正在尝试在 NSString 实例上使用absoluteURL消息。
标签: objective-c nsmutableurlrequest