{"id":151,"date":"2013-02-20T01:15:28","date_gmt":"2013-02-20T01:15:28","guid":{"rendered":"http:\/\/elbsolutions.com\/projects\/?p=151"},"modified":"2022-02-03T11:25:06","modified_gmt":"2022-02-03T17:25:06","slug":"reachability-with-simpleping-wrapper","status":"publish","type":"post","link":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/","title":{"rendered":"Reachability and SimplePing much improved and useable on iOS"},"content":{"rendered":"<p><span style=\"color: #c0c0c0;\">I will do my best to give everyone credit where credit is due &#8211; I have looked at so many websites.\u00a0<\/span><\/p>\n<p><a href=\"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved.png\"><img decoding=\"async\" class=\"alignright size-medium wp-image-156\" alt=\"ReachabilityWithSimplePingMuchImproved\" src=\"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png\" width=\"156\" height=\"300\" srcset=\"https:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png 156w, https:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-300x575.png 300w, https:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved.png 371w\" sizes=\"(max-width: 156px) 100vw, 156px\" \/><\/a>Is your app waiting for the network or an online resource and are you ensuring your users know that there is something going on? If you don&#8217;t take care of this or give your users an idea of what the phone is doing &#8211; or if it is doing anything &#8211; the Apple app store apparently could reject your code and some authors out there&#8230; have been rejected and you put at the end of the line to resubmit.<\/p>\n<p>So &#8211; the app I am making to load webcams for <a title=\"iPhone app for family connection and preschool security camera viewer\" href=\"http:\/\/elbsolutions.com\/projects\/iphone-app-for-security\/\">an in-house preschool security system<\/a>, that is ONLY supposed to work inside the wifi network. Here is a GREAT resource to start with &#8211; you can see if www.apple.com is available. BUT &#8230; I wanted to know if the IP address 192.168.1.12 (a local LAN ip address) was available &#8211; then I know that it is the correct location. The Apple Reachability example AND a MUCH better one from www.ddg.com have a method called reachabilityWithAddress: but it doesn&#8217;t work &#8211; it says everything is available with ANY I.P. address!\u00a0Ideally I want to know if the network IP address of the iphone is the same as that network (<a href=\"http:\/\/www.appsamuck.com\/day4.html\">see WhatsMyIP<\/a>) but that is not in my camera app yet.<\/p>\n<p>I upgraded\u00a0<a href=\"http:\/\/blog.ddg.com\/?p=24\" target=\"_blank\" rel=\"noopener noreferrer\">www.ddg.com&#8217;s code<\/a>\u00a0and converted it to ARC compatible code (refactored it) and modernized it a bit for iOS 6.1.<\/p>\n<p>But the biggest thing, is that I added and wrapped <a href=\"http:\/\/developer.apple.com\/library\/mac\/#samplecode\/SimplePing\/Introduction\/Intro.html#\/\/apple_ref\/doc\/uid\/DTS10000716-Intro-DontLinkElementID_2\" target=\"_blank\" rel=\"noopener noreferrer\">Apple&#8217;s SamplePing<\/a> to it as well &#8211; since that gets me over the hump. I have a question into the fellow that made Reachability better to see if he had insight to the native reachabilityWithAddress: .<\/p>\n<p>It also has a method to set how many times it Ping&#8217;s since SamplePing never stops and how long to retry those subsequent pings. There is a button next to the ping that allows you \u00a0to re-ping. It works when the wifi changes, when cellular changes, when VPN changes &#8211; all sorts of new information available with a utility to help you code your own app instead of guessing what might be working or not.<\/p>\n<p>You can edit the ip address live and it resets\/retries everything again X times &#8211; so in fact it is a useful tool for when you go &#8216;on the road&#8217; to see what flags etc. and conditions your new app sees. In my case, I need to know if the wifi is live, and if I can ping a certain IP address. Then I can let my users know with an activity indicator, what is going on and why the camera&#8217;s do not load &#8211; because most of the time they should not load. When your at the customer&#8217;s location, the cameras should load. Outside or using cellular 3G\/4G or cellular data &#8211; it should tell them that things will not work \u00a0and how to obtain the guest ID of the customer&#8217;s wifi network.<\/p>\n<p>Interesting points and links I used along the way that are not already listed:<\/p>\n<ul>\n<li><span style=\"line-height: 15px;\">SimplePing locks the phone for up to a minute if you continuously ping without waiting for a response. Let it time out before you retry AND run that code in a different thread. New concepts exist that we can take advantage of like closures in Groovy. \u00a0Here is &#8220;Grand Central Dispatch&#8221; <a href=\"http:\/\/www.raywenderlich.com\/4295\/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial\" target=\"_blank\" rel=\"noopener noreferrer\">tutorial #1<\/a> and <a href=\"http:\/\/blog.slaunchaman.com\/2011\/02\/28\/cocoa-touch-tutorial-using-grand-central-dispatch-for-asynchronous-table-view-cells\/\" target=\"_blank\" rel=\"noopener noreferrer\">#2<\/a> that I used<\/span><\/li>\n<li>Githib and XCode &#8211; I have little hair to spend on this. Spend the $$ and download <a href=\"http:\/\/www.git-tower.com\" target=\"_blank\" rel=\"noopener noreferrer\">Tower for Mac<\/a>. Ahhh &#8211; thats better.<\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/7437643\/ios-ping-with-timeout\" target=\"_blank\" rel=\"noopener noreferrer\">apple&#8217;s sockets and timeouts<\/a><\/li>\n<li><a href=\"http:\/\/tympanus.net\/codrops\/2009\/09\/14\/checking-network-reachability-iphone\/\" target=\"_blank\" rel=\"noopener noreferrer\">another good article<\/a> about reachability that helped me understand<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/ebley\/reachabilityWithAddressPing\" target=\"_blank\" rel=\"noopener noreferrer\">Here is the code on git<\/a>. Send me a line if you end up re-using it &#8211; it is nice to know who and where on the Globe one&#8217;s stuff gets to!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I will do my best to give everyone credit where credit is due &#8211; I have looked at so many websites.\u00a0 Is your app waiting for the network or an online resource and are you ensuring your users know that there is something going on? If you don&#8217;t take care of this or give your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-151","post","type-post","status-publish","format-standard","hentry","category-general"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Reachability combined with improved SimplePing - elbsolutions.com<\/title>\n<meta name=\"description\" content=\"Apple&#039;s Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Reachability combined with improved SimplePing - elbsolutions.com\" \/>\n<meta property=\"og:description\" content=\"Apple&#039;s Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/\" \/>\n<meta property=\"og:site_name\" content=\"ELB Solutions.com Inc.\" \/>\n<meta property=\"article:published_time\" content=\"2013-02-20T01:15:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-03T17:25:06+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png\" \/>\n<meta name=\"author\" content=\"Etienne Bley\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etienne Bley\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/\"},\"author\":{\"name\":\"Etienne Bley\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"headline\":\"Reachability and SimplePing much improved and useable on iOS\",\"datePublished\":\"2013-02-20T01:15:28+00:00\",\"dateModified\":\"2022-02-03T17:25:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/\"},\"wordCount\":668,\"image\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/elbsolutions.com\\\/projects\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/ReachabilityWithSimplePingMuchImproved-156x300.png\",\"articleSection\":[\"General\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/\",\"name\":\"Reachability combined with improved SimplePing - elbsolutions.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/elbsolutions.com\\\/projects\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/ReachabilityWithSimplePingMuchImproved-156x300.png\",\"datePublished\":\"2013-02-20T01:15:28+00:00\",\"dateModified\":\"2022-02-03T17:25:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"description\":\"Apple's Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#primaryimage\",\"url\":\"http:\\\/\\\/elbsolutions.com\\\/projects\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/ReachabilityWithSimplePingMuchImproved-156x300.png\",\"contentUrl\":\"http:\\\/\\\/elbsolutions.com\\\/projects\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/ReachabilityWithSimplePingMuchImproved-156x300.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/reachability-with-simpleping-wrapper\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reachability and SimplePing much improved and useable on iOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\",\"name\":\"ELB Solutions.com Inc.\",\"description\":\"Bringing all your IT Pieces together\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\",\"name\":\"Etienne Bley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"caption\":\"Etienne Bley\"},\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/author\\\/etienne-bley\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Reachability combined with improved SimplePing - elbsolutions.com","description":"Apple's Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/","og_locale":"en_US","og_type":"article","og_title":"Reachability combined with improved SimplePing - elbsolutions.com","og_description":"Apple's Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.","og_url":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/","og_site_name":"ELB Solutions.com Inc.","article_published_time":"2013-02-20T01:15:28+00:00","article_modified_time":"2022-02-03T17:25:06+00:00","og_image":[{"url":"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png","type":"","width":"","height":""}],"author":"Etienne Bley","twitter_misc":{"Written by":"Etienne Bley","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#article","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/"},"author":{"name":"Etienne Bley","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"headline":"Reachability and SimplePing much improved and useable on iOS","datePublished":"2013-02-20T01:15:28+00:00","dateModified":"2022-02-03T17:25:06+00:00","mainEntityOfPage":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/"},"wordCount":668,"image":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#primaryimage"},"thumbnailUrl":"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png","articleSection":["General"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/","url":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/","name":"Reachability combined with improved SimplePing - elbsolutions.com","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/#website"},"primaryImageOfPage":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#primaryimage"},"image":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#primaryimage"},"thumbnailUrl":"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png","datePublished":"2013-02-20T01:15:28+00:00","dateModified":"2022-02-03T17:25:06+00:00","author":{"@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"description":"Apple's Reachability has been combined with iOS converted version of SimplePing. It has been upgraded to ARC and 6.1. Use it as a app design utility.","breadcrumb":{"@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#primaryimage","url":"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png","contentUrl":"http:\/\/elbsolutions.com\/projects\/wp-content\/uploads\/2013\/02\/ReachabilityWithSimplePingMuchImproved-156x300.png"},{"@type":"BreadcrumbList","@id":"https:\/\/elbsolutions.com\/projects\/reachability-with-simpleping-wrapper\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/elbsolutions.com\/projects\/"},{"@type":"ListItem","position":2,"name":"Reachability and SimplePing much improved and useable on iOS"}]},{"@type":"WebSite","@id":"https:\/\/elbsolutions.com\/projects\/#website","url":"https:\/\/elbsolutions.com\/projects\/","name":"ELB Solutions.com Inc.","description":"Bringing all your IT Pieces together","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/elbsolutions.com\/projects\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39","name":"Etienne Bley","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","caption":"Etienne Bley"},"url":"https:\/\/elbsolutions.com\/projects\/author\/etienne-bley\/"}]}},"_links":{"self":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/comments?post=151"}],"version-history":[{"count":7,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/151\/revisions"}],"predecessor-version":[{"id":2875,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/151\/revisions\/2875"}],"wp:attachment":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/media?parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/categories?post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/tags?post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}