madhavi
madhavi

Reputation: 174

initWithContentsOfURL failing to return data

Below is my code, this code works fine on iphone but same code when i debug using ipad as target it does not work. Please advice me the proper way to call. I cant do Async call as my already other threads are going in background.

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

Upvotes: 1

Views: 417

Answers (1)

Rob Napier
Rob Napier

Reputation: 299355

There are numerous reasons this may not work. The most likely is that SharedGlobals.ReuestURL is nil, or temptest is nil, or the combination of the two does not create the correct URL (perhaps missing a /). Check each piece, and check your logs for errors.

However, this statement makes no sense:

I cant do Async call as my already other threads are going in background.

Do you mean that this call initWithContentsOfURL: is already on a background thread?

Objective-C local variables (ImageData) should always start with a lowercase letter (imageData).

Upvotes: 1

Related Questions