0
votes

While I m trying to get data from the URL it returns nil. But the same line works in other projects. I have tested it with by creating new project. My code is here

NSData *imgData=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://image.projectnext.eu/RBXF_Icon.jpg"]];

it gets data perfectly in my test project but not working in needed project. Is there any settings to be enabled in my original project?

1
I've seen some of the NSURL objects not working properly outside of the main thread. Is this code running in the mainthread or in a background? - Bryan McLemore
Actually i was uased in the background process that is in new thread, later seeing that the NSData not working well, I tried in the main thread too it not working. One more thing is whatever variable that I m declaring gets nil within the next line of execution. For example I tried just assigning a value for a string. NSSTRing *str=@"String added"; While I m trying through debugger. in next line of execution the string value becoming nil. It show str value as "<varaible Invalid". Wat the same happened for the NSData. - Manoj Kumar

1 Answers

0
votes

Make sure you have network connectivity -- either WiFI or over the phone network....