Reachability on iPhone app with a false positive - will it get past apple?

僤鯓⒐⒋嵵緔 提交于 2020-01-13 19:20:08

问题


I am using this code...

Reachability *r = [Reachability reachabilityWithHostName:@"www.maxqdata.com"];

NetworkStatus internetStatus = [r currentReachabilityStatus];

if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for location finding to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
} 

from this thread

http://www.iphonedevsdk.com/forum/iphone-sdk-development/19546-no-wifi-connection-best-practice-2.html#post118631

to check for internet connections. Whilst this is working in principle I am getting a false positive in the situation when a cellular network is available but can't be activated, does anyone have any ideas on how to detect for this scenario?

Alternatively this is likely to happen so rarely I can always just ignore it and give an error when the NSURLConnection method can't connect - my worry here is that it may not get past the vetting process, does anyone have any experience with this?

Thanks


回答1:


The only "reachability" code I've included in some of my apps is to display an error if connections time out - as long as you handle intermittent or no connectivity gracefully it will get past vetting. Crashing out, or hanging waiting for a response forever will get you rejected. As a rule of thumb, I'd say anything the user will find acceptable, I've found Apple do too *.

*(** your mileage may vary)



来源:https://stackoverflow.com/questions/3086816/reachability-on-iphone-app-with-a-false-positive-will-it-get-past-apple

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!