{"id":1294,"date":"2013-10-04T17:22:09","date_gmt":"2013-10-05T00:22:09","guid":{"rendered":"http:\/\/zsprawl.com\/iOS\/?p=1294"},"modified":"2013-10-04T17:23:16","modified_gmt":"2013-10-05T00:23:16","slug":"fix-the-warnings-in-phonegap-3-0","status":"publish","type":"post","link":"http:\/\/zsprawl.com\/iOS\/2013\/10\/fix-the-warnings-in-phonegap-3-0\/","title":{"rendered":"Fix the Warnings in PhoneGap 3.0"},"content":{"rendered":"<p>With the move to PhoneGap 3.0, we are moving to a 64-bit framework, and as such, there are a few legacy bugs that exist. Nothing big of course, just warnings, but for someone that likes to see a clean error log before submitting to the App store, it can be annoying.<\/p>\n<p>Here are the errors:<\/p>\n<blockquote><p>hello\/platforms\/ios\/CordovaLib\/Classes\/CDVURLProtocol.m:168:46: Implicit conversion loses integer precision: &#8216;long long&#8217; to &#8216;unsigned long&#8217;<br \/>\nhello\/platforms\/ios\/CordovaLib\/Classes\/CDVURLProtocol.m:169:100: Implicit conversion loses integer precision: &#8216;long long&#8217; to &#8216;NSUInteger&#8217; (aka &#8216;unsigned int&#8217;)<\/p><\/blockquote>\n<p>If you open up the CDVURLProtocol.m file in xcode, you find these two lines of code at lines 168 and 169.<\/p>\n<p>[code]Byte* buffer = (Byte*)malloc([assetRepresentation size]);<br \/>\nNSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:[assetRepresentation size] error:nil];[\/code]<\/p>\n<p>The fix is rather easy. All you need to do is typecast the variables as follows.<\/p>\n<p>[code]Byte* buffer = (Byte*)malloc((unsigned)[assetRepresentation size]);<br \/>\nNSUInteger bufferSize = (NSUInteger)[assetRepresentation getBytes:buffer fromOffset:0.0 length:\t(NSUInteger)[assetRepresentation size] error:nil];[\/code]<\/p>\n<p>It really is that simple and cleans up those warnings right quick.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the move to PhoneGap 3.0, we are moving to a 64-bit framework, and as such, there are a few legacy bugs that exist. Nothing big of course, just warnings, but for someone that likes to see a clean error log before submitting to the App store, it can be annoying. Here are the errors: <a href=\"http:\/\/zsprawl.com\/iOS\/2013\/10\/fix-the-warnings-in-phonegap-3-0\/#more-'\" class=\"more-link\"><br \/>more \u00bb<\/a><\/p>\n","protected":false},"author":318,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,38,3,67],"tags":[121,5,34,40],"class_list":["post-1294","post","type-post","status-publish","format-standard","hentry","category-blog","category-cordova","category-ios-development","category-javascript","tag-cordova","tag-ios","tag-phonegap","tag-xcode"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/1294"}],"collection":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/users\/318"}],"replies":[{"embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/comments?post=1294"}],"version-history":[{"count":5,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/1294\/revisions"}],"predecessor-version":[{"id":1299,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/1294\/revisions\/1299"}],"wp:attachment":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/media?parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/categories?post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/tags?post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}