objective c - Neither connectionDidFinishLoading: nor didFailWithError: get invoked -
calling
connectioninprogress = [[nsurlconnection alloc] initwithrequest:request delegate:self startimmediately:yes];
when disconnect , reconnect internet simulator. 1 call initwithrequest: not causing neither connectiondidfinishloading:
nor didfailwitherror:
invoked.
i call in loop , getting following results (when disconnected).
didfailwitherror: fetch failed: internet connection appears offline.
next call after few seconds (as internet reconnected).
didfailwitherror: fetch failed: server specified hostname not found.
and next time call neither of 2 callbacks being invoked.
i ran same problem iphone simulator.
after 6 hours of debugging, googling , searching stackoverflow have found solution: the iphone simulator has bug! (or @ least tests proved).
when disconnect wifi/internet cable mac trying simulate network connectivity disappearing, not simulated in iphone simulator! (in fact if notice wifi connectivity icon on simulator not disappear)
i have tried deploy app (which creates nsurlconnection well) on iphone 4, , if put in airplane mode didfailwitherror gets called! while instead not happening on simulator!
note using xcode 4.0 , developing ios 4.3
so answer is: try deploy app on real ios device , work!
Comments
Post a Comment