{"id":1391,"date":"2014-08-04T00:48:41","date_gmt":"2014-08-04T00:48:41","guid":{"rendered":"http:\/\/www.trivedigaurav.com\/blog\/?p=1391"},"modified":"2014-12-19T15:45:46","modified_gmt":"2014-12-19T15:45:46","slug":"plyer-on-ios","status":"publish","type":"post","link":"https:\/\/www.trivedigaurav.com\/blog\/plyer-on-ios\/","title":{"rendered":"Plyer on iOS"},"content":{"rendered":"<p>I finally had access to an iOS development device this week. Unlike the other platforms, I didn&#8217;t have any prior experience developing for it. So I spent some time familiarizing myself with the tools and stuff. This process was mostly painless but did end up consuming some time.<\/p>\n<p>I also setup my <a href=\"http:\/\/github.com\/kivy\/kivy-ios\">kivy-ios<\/a> tool chain for the first time. After a couple hello-world programs and fixing minor typos in the examples code, I then moved on to further explore <a href=\"http:\/\/github.com\/kivy\/pyobjus\">pyobjus<\/a> for writing Plyer facades. I worked on a <a href=\"https:\/\/github.com\/kivy\/pyobjus\/pull\/13\">new version<\/a> of the accelerometer example that was not dependent on <code>bridge.m<\/code> supplied with all kivy-ios packages by default. When I am done moving all the sensors we could do away with the classes contained in the bridge (<em>note to self<\/em>!).<\/p>\n<p>While playing with this code, I also noticed something interesting on the Xcode dashboard:<\/p>\n<blockquote class=\"twitter-tweet\" lang=\"en\"><p>Xcode visualizations helps find otherwise unsuspected errors such as the memory leak here &#8211; <a href=\"http:\/\/t.co\/iEEnK2d23t\">pic.twitter.com\/iEEnK2d23t<\/a><\/p>\n<p>\u2014 Gaurav Trivedi (@trivedigaurav) <a href=\"https:\/\/twitter.com\/trivedigaurav\/statuses\/495308193128808448\">August 1, 2014<\/a><\/p><\/blockquote>\n<p><script src=\"\/\/platform.twitter.com\/widgets.js\" async=\"\" charset=\"utf-8\"><\/script><\/p>\n<p>Turns out that we had a hit a major bug in Pyobjus that was causing the memory allocated for <code>accelerometerData<\/code> to leak. In fact this would happen everywhere you&#8217;d otherwise need to use something like <code>@autoreleasepool<\/code> in your Objective C code. Pyobjus objects didn&#8217;t account for cases like these. <a href=\"https:\/\/github.com\/tito\">Tito<\/a> suggested a fix for the issue but is still working on finalizing it.<\/p>\n<p>Meanwhile, I also created another iOS facade for retrieving <a href=\"https:\/\/github.com\/kivy\/plyer\/pull\/86\">battery status<\/a>. Although it was a fairly short one to code but I did have to learn many background things before I could finish that. I hope that this will make it easy for me to finish the other facades in the coming weeks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I finally had access to an iOS development device this week. Unlike the other platforms, I didn&#8217;t have any prior experience developing for it. So I spent some time familiarizing myself with the tools and stuff. This process was mostly painless but did end up consuming some time. I also setup my kivy-ios tool chain &hellip; <a href=\"https:\/\/www.trivedigaurav.com\/blog\/plyer-on-ios\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Plyer on iOS<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[22,23,24],"tags":[],"class_list":["post-1391","post","type-post","status-publish","format-standard","hentry","category-projects","category-python","category-updates"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p46eol-mr","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/comments?post=1391"}],"version-history":[{"count":15,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/1391\/revisions"}],"predecessor-version":[{"id":1572,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/posts\/1391\/revisions\/1572"}],"wp:attachment":[{"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/media?parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/categories?post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trivedigaurav.com\/blog\/wp-json\/wp\/v2\/tags?post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}