How to make an iAd integrated iPhone app working on previous versions of iPhone OS? - iphone

As title described, I integrated iAd into my iPhone apps. Everything worked fine in the iPhone simulator (iOS4). However, when I try to install it on my iPhone(version 3.1.3), I got an error:
dyld: Library not loaded: /System/Library/Frameworks/iAd.framework/iAd
Referenced from: /var/mobile/Applications/...
Reason: image not found
I already properly set the deployment target to v3.0, and base SDK to 4.0. When I comment out all the iAd related code, the apps installs with no problem.
There must be a way to do this, because I downloaded the apps "showtimes" and "Yellow Pages", which use iAd. Both apps run very well on my 3.1.3 phone, and I can see the iAd as well.
Does anybody know how to do this?

To get past the loader error, double-click your target in Xcode and change the link type of the iAds.framework to "Weak" instead of "Required". You'll probably have to do some conditional coding to support other ad networks as well, because iAds are not supported on pre-4.0 systems.

In xCode 4 select "Targets"-"Build Phases"- "Link Binary With Libraries". Change the link type of the iAd.framework to "Optional" instead of "Required".

You can integrate AdWhirl into your app instead, which can deliver you iAds among others. More usefully, it will provide you with adverts you can display in iOS3.*.

Related

XCode v4.2 and Default-568h#2x.png --> "Invalid Binary" Message When Submitting iOS App

I spent many hours trying to figure this issue out. Apple continuously accepted my uploaded binary when I was submitting my app through XCode4.2, yet only to declare the binary invalid minutes later. It turned out that it was because I had placed the "Default-568h#2x.png" in my resources folder in an attempt to support iPhone 5's splash screen and eliminate "letterbox mode" (black top and bottom bars)... I am using a 2006 MacBook Pro, and thus am unable to upgrade to Lion OS or Xcode4.5. Also, I am able to build AdHoc versions for my customer that runs just fine on the iPhone 5 (filling its entire screen).
Does anyone know of a workaround I can implement to get Apple to accept my binary while still being able to support iPhone 5's larger screen (no black top or bottom bars)? If I re-name "Default-568h#2x.png" I am able to get Apple to accept my binary, but will I lose compatibility with iPhone5?
I found the following link in my search, which seems to suggest the startup image has nothing to do with the iPhone 5's letterbox mode, and can be labeled any name. However, I must admit, I am rather lost when the writer begins discussing 'viewports' and 'media queries'...
http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
Thanks in advance for any help you can offer!
Apple has made a deliberate decision to only allow two types of apps:
Apps built with XCode 4.4 and earlier, built for iOS up to version 5, including support for armv6 (required for iPhone 3G) but without support for iOS 6 and without support for the larger screen of the iPhone 5.
Apps built with XCode 4.5, built for at least iOS 4.3, possibly supporting the larger screens (Default-568h#2x.png) but without support for iOS before 4.3 and without support for the armv6 architecture (required for iPhone 3G).
All others apps are now rejected if you upload them to the App Store. Your app is rejected because it's includes Default-568h#2x.png and one the following things: either armv6 support or support for iOS before 4.3.
Without XCode 4.5, it's impossible to create an app the support the larger iPhone 5 screen and is accepted by Apple.
Some people have managed to build and upload applications the support both iPhone 3G and iPhone 5. But this is very tricky and requires a parallel installation of at least XCode 4.5 and one earlier version.
Update:
If I'm not mistaken, the crucial points for supporting the larger screen are:
The launch image Default-568h#2x.png
The setting of Base SDK being iOS 6 (or later)
If you add the launch image without setting the Base SDK to iOS 6, iTunes Connect will reject you app:
"Invalid Launch Image - You app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later."
Without XCode 4.5, you cannot select iOS 6 as the Base SDK.
I was able to install iOS 6.0 SDK on my XCode v4.2 following these instructions:
Is it possible to get the iOS 5.1 SDK for Xcode 4.2 on Snow Leopard?
Afterwards, I could create a binary with the below attributes that Apple would accept.
The launch image Default-568h#2x.png
The setting of Base SDK being iOS 6 (or later)
I have have a Mac mini from 2006, running Snow Leopard, Xcode 4.2. I was having the exact same problem with my submissions last night (May 2, 2013). Organizer uploads the app, and says all is fine. Within a couple of minutes The email below comes through. I did what the email suggested. Then I double checked, triple checked all settings, recreated certificates/profiles....still invalid binary.
Early in development, I was able to crack a dmg to get iOS6 installed on my machine. I put Default-568h#2x.png in my app. I tested ad hoc installations on a 5th gen iPod Touch - everything worked fine, BUT Apple won't accept my app.
I was going to get a new mac this year anyway. I'm heading to the Apple store to get one tonight. Here's the email from Apple:
Dear developer,
We have discovered one or more issues with your recent delivery for "Gazoodle Colours". To process your delivery, the following issues must be corrected:
Invalid Signature - Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target.
Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary.
Regards,
The App Store team
Update: Got a new macbook pro, built my app with the latest Xcode (4.6.2) and resubmitted the app. My app is finally in the Waiting for Review state. Wasn't sure buying a new computer would solve the problem, but it was a good excuse to upgrade the hardware, and it actually fixed the invalid binary issue!

Exclude devices that do not support multitasking

I'm making an app that requires multitasking. Is there a way to compile an iPhone/iPad (universal) app so it excludes devices that do not support multitasking. I know iPhone 1, iPhone 3G and iTouch 1-2 do not support multitasking but I haven't found a way to build my app so it prevents people to download the app from the app store if they have one of these devices.
I was thinking to simply set the "Architectures" setting to armv7 on Xcode but I'm not sure if this will work and if it will have any other consequences.
Any help will be appreciated. Thanks!
You can set the minimum API level supported to be iOS 4.3. This version only runs on devices that support multi-tasking.
You should check in your application for multitasking support and fall back to a non multitasking alternative if it is not available.
Suppose you change the supported architectures to include ARM7 upwards. If you do, you need to find out what happens if somebody attempts to deploy such an application to an incompatible device. If iTunes stops them from doing it, that's fine and it's the right answer. But if iTunes lets them do deploy the app and it crashes when they try to run it, it would be far better to do the test for multitasking support and display an alert telling the user why your app won't work.
Go to targets section of your project--> navigate to Build Tab-->Go to Deployment tab & select IOS deployment target as 4.2. It will not run on IOS versions earlier than this.

Updating iPhone application from 3.0 to iOS4

I was just wondering if anyone knows of any articles relating to upgrading an iPhone application from 3.0 to iOS4. (Thanks for this iWasRobbed).
While the application still runs on iOS4, it will not run on the iPhone 4, but does on my iPhone 3G.
When I deploy the app on the iPhone 4, the Default screen loads and it will sit there hanging. The only inclination towards a problem I get is this warning:
warning: UUID mismatch detected with the loaded library - on disk is:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
warning: UUID mismatch detected with the loaded library - on disk is:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress
Thanks
James
James,
Apple has provided this checklist: http://developer.apple.com/iphone/checklist/
It generally should not be that big of an issue. Typically, you just set the baseline SDK as 4.0 and the deployment target as either 4.0 or something 3.0+.
If it is not running on an iPhone 4, you may wish to explain further what specifically it is doing or not doing when you attempt to run it on that device. Keep in mind that all apps (for the most part) that were designed to run on 3.0 and above will typically run well on an iPhone 4.
There might be some issues with deprecated methods, so make sure you resolve those prior to installing and running the app. You should get a compiler warning for any of those, if not check your target settings and there should be a checkbox for it.
Other than that, I'm not sure what else would prevent you without understanding further details of your project.
As additional information, you should really look into the WWDC 2010 video called "Future Proofing Your Applications" (watching it now :)
That is most likely a mismatch between what iOS your iPhone 4 is running and what SDK you're using in Xcode. The UUIDs are mismatched because the iPhone 4 is using a different version SDK to what you've coded in.
Solution, install the latest SDK and make sure your iPhone matches this. The latest out is 4.1
I had the same problem and think I have solved it because the problem has gone away.
Firstly I deleted the build folder. Then I Installed the latest version of ios (4.1 in this case) onto my iphone through itunes. Afterwards i installed the latest xcode and iphone sdk package from the apple devlopers site.
This in itself probably fixed the problem but just to be sure I added a new provisioning profile for the phone on my computer and everything worked great afterwards.
Hope that helps

How do I install my AppCelerator App to my IPhone

I am attempting to load a small application I wrote with AppCelerator on my device. I am having quite a bit of trouble with this because of iOS target mismatches I suspect.
AppCelerator provides me two options for the target OS, 3.2 and 4.1. My Phone has firmware 4.1 on it so I selected 4.1:
Here is a picture if you want to have a look.
Note that in this image I am selecting output type of 4.1. This generates an XCode project with 4.1 as the base sdk / target sdk of 4.1.
When I launch this it generates an XCode project. Organizer contains the following devices and provisioning profiles:
Here is a picture of organizer.
It contains my device, with provisioning profiles, with a green dot beside the device meaning it should be a valid target.
Then when I try to run the app on my device I see the following options as available targets:
Finally here is the dropdown where you select simulators and devices.
Notice it simply doesn't contain my device as it did before I upgraded to the new SDK and 4.1 iOS.
I assumed I would be able to push to my iphone at this time - have tried all I know to try. Blown away all my provisioning profiles, regenerated my developer certificate, also deleted my login keychain to make sure that I started fresh there.
I am really just out of ideas to try - appreciate any and all help!
It appears that the answer was quite simple. After kludging around in XCode for hours I found (or noticed) another tab on the AppCelerator interface.
Click on Test & Package
Click on Run on Device
Fill out the details for provisioning if they aren't already (this is likely all done if you went through the level of detail on Apple Documentation that I did)
Click Install Now
Voila - the app is on your phone for testing.
The Apple Terms and Conditions do not allow apps built outside Xcode to be installed to iOS devices. I would think this applies to AppCelerator builds as well.

Error when weak-linking StoreKit framework on iPhone

I am trying to add In App Purchase support to my app. I would like the app to still be able to support OS2.2.1, but IAP are not available unless the OS version is 3.0 or higher.
I have tried weak-linking the StoreKit framework. Basically, I have StoreKit.framework added to frameworks, but not in Link Binary With Libraries in the target, and have added weak_framework -StoreKite to the other flags line, as per the Apple instructions. Now when I run the app on OS2.2.1 it crashes in _read_images before the main function is even executed. I really need to support 2.2.1 and I know other apps do it. Thanks for any help.
I just ran into a similar issue with the iAd Framework. Well sort of. I thought it was the iAd Framework but when I completely commented out all the new code and removed the framework it was still crashing.
It worked on the Simulator just not on the device. I found posix_spawn("/var/mobile/Applications/...", ...): Permission denied in the Console logs.
This lead me to believe that it was some type of code-signing error. I deleted the app from the device and re-installed. This launched the app successfully.
It appears there was some remnants of the version installed on the device from the released version did not allow the debug version to install correctly.