我在编写一个有方法有参数的类方法时遇到了问题.
该函数在"SystemClass.m/h"类中
//JSON CALL
+(void)callLink:(NSString*)url toFunction:(SEL)method withVars:(NSMutableArray*)arguments {
if([self checkConnection])
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *datas = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
[arguments addObject:datas];
[self performSelectorOnMainThread:@selector(method:) withObject:arguments waitUntilDone:YES];
});
}else{
[self alertThis:@"There is no connection" with:nil];
}
}
Run Code Online (Sandbox Code Playgroud)
该函数的作用是调用JSON url,并将数据提供给Method
我这样使用它:
[SystemClass callLink:@"http://www.mywebsite.com/call.php" toFunction:@selector(fetchedInfo:) withVars:nil];
Run Code Online (Sandbox Code Playgroud)
但它像这样崩溃:
因未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'+ [SystemClass方法:]:无法识别的选择器发送到类0x92d50'
你可以帮帮我吗?无论如何,我正试图找到解决方案!
谢谢,亚历克斯