Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone initWithContentsOfURL无法返回数据_Iphone_Objective C - Fatal编程技术网

Iphone initWithContentsOfURL无法返回数据

Iphone initWithContentsOfURL无法返回数据,iphone,objective-c,Iphone,Objective C,下面是我的代码,这段代码在iphone上运行良好,但当我使用ipad作为目标进行调试时,这段代码不起作用。请告诉我打电话的正确方式。我不能做异步调用,因为我已经有其他线程在后台运行 NSData *ImageData=[[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", SharedGlobals.ReuestURL, temptest]]] autorelea

下面是我的代码,这段代码在iphone上运行良好,但当我使用ipad作为目标进行调试时,这段代码不起作用。请告诉我打电话的正确方式。我不能做异步调用,因为我已经有其他线程在后台运行

NSData *ImageData=[[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", SharedGlobals.ReuestURL, temptest]]] autorelease];

这可能不起作用的原因有很多。最有可能的情况是
SharedGlobals.ReuestURL
nil
,或者
tentest
为nil,或者两者的组合无法创建正确的URL(可能缺少
//code>)。检查每一部分,并检查日志中的错误

然而,这种说法毫无意义:

我不能做异步调用,因为我已经有其他线程在后台运行

NSData *ImageData=[[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", SharedGlobals.ReuestURL, temptest]]] autorelease];
您的意思是说此调用
initWithContentsOfURL:
已在后台线程上


Objective-C局部变量(
ImageData
)应始终以小写字母(
ImageData
)开头。

这可能不起作用的原因很多。最有可能的情况是
SharedGlobals.ReuestURL
nil
,或者
tentest
为nil,或者两者的组合无法创建正确的URL(可能缺少
//code>)。检查每一部分,并检查日志中的错误

然而,这种说法毫无意义:

我不能做异步调用,因为我已经有其他线程在后台运行

NSData *ImageData=[[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", SharedGlobals.ReuestURL, temptest]]] autorelease];
您的意思是说此调用
initWithContentsOfURL:
已在后台线程上


Objective-C局部变量(
ImageData
)应始终以小写字母(
ImageData
)开头。

但它适用于iphone我的问题是,为什么它不适用于iPadt这并不会改变您应该如何调试它。首先,确保这里的任何内容都不为零,表达式的每个部分的计算结果都是您认为应该的。但它在iphone上工作。我的问题是,为什么它不在iPadt上工作这不会改变您应该如何调试它。首先确保此处的值均为零,并且表达式的每个部分的计算结果都是您认为应该的值。