Not everyone can afford to pre-order the new iPhone 4S – There are still a lot of users out there with the iPhone 3G and even more with the iPod Touch ( 2nd Generation. ) Both of these devices can run up to iOS 4.2 and require armv6 code.
You can only safely drop armv6 support if set your deployment target to iOS 4.3+ which runs on the iPhone 3GS/4, iPod (3rd Gen), iPad/iPad2. Actually, anything after 4.3 can be set to Optimized armv7 but that’s a totally different blog post
Here’s a quick and dirty guide to get you armv6 support in your iOS projects:
1.) Go to Project -> Build Settings -> Architectures -> Architectures:
2.) Click on Architectures and select Other. . .
3.) select $(ARCHS_STANDARD_32_BIT) and click the (-) to delete it.
4.) Click the (+) sign and add armv6
5.) Click the (+) sign again and add armv7 then click Done
6.) Find your apps Info.plist file and delete the Key called Required device capabilities
I believe that’s it. At first I did all the above steps except for #6 and while reveiwing my app in iTunes Connect I noticed something odd:
I saw my Supported Architectures as planned but what I wasn’t counting on was the Required Capabilities. If armv7 is required it seems to me that support for armv6 would be futile? So i fired up xcode and this time I actually tried to build my app on an old iPod Touch. No joy :-( even though it was showing the correct Supported Architectures. I deleted the Required device capabilities Key from the Info.plist and bingo. I re-upped my binary and all seems right with the world:
If I’m doing something wrong please feel free to let me know I’d rather do things the preferred way plus id rather not spread incorrect information. Thanks!
It’s recommended practice to treat build warnings the same as errors so here’s a handy little tidbit to help you out:
The deprecated way:
NSArray *fileList = [manager directoryContentsAtPath:productDirectory];
replace directoryContentsAtPath with contentsOfDirectoryAtPath & you must also add error:nil
The new hotness:
NSArray *fileList = [manager contentsOfDirectoryAtPath:productDirectory error:nil];
This tutorial assumes that you already have both a valid iOS Distribution Certificate and Distribution Provisioning Profile installed. If not you may want to take a look here. It is also assumed that you have at least one application submitted to iTunes Connect that is in the state of “Waiting For Upload.”
1.) Open your project and go to your projects Info Tab
2.) Under “Configuration” click (+) and select Duplicate “Release” Configuration
3.) Name this new configuration “Distribution”
4.) Go to your projects Build Settings
5.) Under Code Signing > Code Signing Identity – Find Distribution
6.) Under Distribution find “Any iOS SDK” and select your Distribution Provisioning Profile
7.) Now go to the Edit Scheme drop-down list and select your app + iOS Device
8.) After that from the same Edit Scheme drop-down select “Edit Scheme . . .”
9.) Find the Archive settings (which are set to Release by default) and expand them
10.) Select the “Archive” option that has a check mark next to it
11.) With this selection highlighted find “Build Configuration” on the right Choose “Distribution” from the drop down and click OK
*Optional* I like to do a “Clean” before making a distribution build. If you like select Product > Clean
12.) To create your Archive/Distribution Build select Product > Archive
If your project compiles without error the Organizer is opened to the Archives
13.) Now click “Validate . . .”
14.) Provide your iTunes Connect login credentials and click Next
15.) Select your application from the “Application” drop down
16.) Select your appropriate Distribution Certificate from the “Identity” drop down and click Next
* Hopefully no issues are found and your app is ready for submission. If not make the necessary corrections then recreate your Archive build and validate again.
17.) If no issues were found then click “Submit . . . “
18.) Provide your iTunes Connect login credentials and click Next
19.) Select your application from the “Application” drop down
20.) Select your appropriate Distribution Certificate from the “Identity” drop down and click Next
* iTunes Connect validates your app again (just incase you didn’t manually validate) and then uploads the binary
Sit back, Thats it.
You should receive a msg stating your app has passed validation and has been submitted to the App Store for further review!
After spending way too much time trying to implement my own solution that would rotate ads from different networks in my free applications I decided to go with pre-made solution called DTBannerManager. It was created by Oliver Drobnik (@Cocoanetics) and is available for purchase in his Parts Store. Now what this does is exactly what I wanted and more It will check for iAds, then AdMob and Mobfox if you want. It also does it with style as the new ads slide in smoothly. It works on both 3.x & 4.x versions of iOS and is even compatible with tab bar controllers. Just to put the cherry on top you can also offer your users the option to remove the ads completely through IAP.
Implementation in a native iOS app couldn’t be simpler . . .
[[DTBannerManager sharedManager] addAdsToViewController:tabBarController];
After further review and a little help from a friend we discovered the issue. The PhoneGap AppDelegate seems to create the webview then the view controller, then pushes the webview into the view controller which in turn calls webViewDidFinishLoad. This seems to be the key. We cannot access the viewController object until webViewDidFinishLoad has been called. Hence we instantiate DTBannerManager like so . . .
Now you think I’d be super stoked at this point right? Wrong. I discovered that upon clicking a Mobfox Ad the app would immediately crash. Turns out I left out the Other Linker Flags -ObjC & -all_load which are required for the Mobfox.framework. No problem, just add them right? Wrong. As soon as I did my builds were failing with a Duplicate symbol error on the file NSData+Base64.h. Apparently both the phonegap.framework & the Mobfox.framework both depend on NSData+Base64.
Turns out that only the Mobfox.framework actually depends on it. My simple phonegap app had no use for it. I posted to the PhoneGap Google Group and was re-leaved to find a simple solution. PhoneGap provides you everything necessary to compile your own custom version of the phonegap.framework. You can find the specifics in the FAQ #10. I just compiled a new copy of the framework minus the header file and any refrences to NSData+Base64.h. I deleted the pre-existing phonegap.framework from my project and imported my new custom framework and immediately the Duplicate symbol errors were gone and DTBannerManager was operating correctly – Mobfox ads and all.
This article is based off of PhoneGap for iOS version 1.0.0. You can download my custom phonegap.framework if you would also like to use DTBannerManager or Mobfox Ads in your phonegap project. I highly recommend DTBannerManager – it couldn’t be easier and besides it will increase your ad revenue! Get it and other great components from the Cocoanetics Parts-Store.
The COCO SAMURAI is kind enough to continuously maintain and update this very handy cheat sheet of xcode shortcuts. It has been updated for the latest xcode 3.2
You are encouraged to share the knowledge Here’s a link to the original article just in case the links go down:
I was interviewed over the telephone a few months back by a reporter for the San Fransisco Gate Newspaper, Ryan Kim. We talked about how/why I got started coding for the iPhone. The conversation lasted for about 30 minutes. A few months passed and I completely forgot the conversation ever happened. Well, yesterday I was doing a little Googling and I accidentally ran into a copy of the published article posted online. The writer had never gotten back to me re: whether or not my interview had made it to print so I was happily surprised to see it. The article never names “Keyvisuals” per say, but I promise you I’m in there =)
Even cooler, after I did a little more searing around I found that the article had been translated into two different languages (one which I think is Chinese and the other I’m not sure but seems like it may be middle eastern) and posted on different foreign blogs.
Just in case the links go down I took screen shots (below)
I had my 15 minutes and I didn’t even know it.