I would need to see the details of the failure, but more source code would be 100% sure, but I suppose this is because your NSUrlRequest instance NSUrlRequest declared as a local variable. Promoting this variable in your type field should solve this problem.
An instance may still be required as soon as the method completes its execution. However, at this time it is no longer mentioned, and the garbage collector can collect it at any time. If you collected, you are likely to get a crash, as you mentioned.
The fact that this does not happen on the simulator is most likely due to the fact that it is faster (than the device) and the code may exit before the GC collects this instance. IOW, this can cause it to crash just time, which makes it work most of the time on the simulator and almost never on devices.
source share