Error when weak-linking StoreKit framework on iPhone - 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.

Related

Can I prevent users with a too-old OS version from downloading my app?

I currently have an app in the app store that works for iPhone users running iOS version 3.0 or newer. My next version of the app is going to use ARC, so it will only work for users running iOS version 4.0 or newer.
According to this answer, the users will be able to download the newer version, but it just won't run when they try to run it.
Is there any way to prevent users who can't run the app from even downloading it from the AppStore?
I haven't tested this recently, but in February 2011, and iOS 4.x, I had users who couldn't download my app as there device wasn't running the required version of iOS.
They received a nice explanation message on their device, courtesy of the App Store app, when trying to download the app directly to their device.
I'd be very surprised if this wasn't still the case.
So, set the deployment target in your target build settings, and let the App Store / iTunes take care of who can install it.
That was for new installs, and it be different for updates (rather than new installs) but again I'd be surprised if this wasn't handled by Apple for the sake of a better user experience.
UPDATE
I dug out my old iPhone 3 which reached the end of the road at 4.2.1 and resynced it with iTunes - the latest apps that require 4.3 etc are ignored, and are not overwritten with incompatible versions, as I would expect.
I also tried to update my own app (I'm a developer), requiring 4.3 and above, from the store via the device itself, and got a polite pop-up alert saying the app requires iOS 4.3 and above, again just as I'd expect.
The app was previously compatible with < 4.3, and somewhere along the line I bumped up the minimum iOS version requirement, so it is definitely possible.
So, you should just set your updated app's 'deployment target' version appropriately, and it will only be updated on compatible devices.
No. A new higher minimum Deployment target will prevent a user from installing an app on a device with a lower OS version, but will not prevent them from downloading the app using iTunes on their Mac or PC, even though they can't install the update once downloaded.

Issue with CoreLocation and Adhoc Distribution

We're developing an application that uses CoreLocation as a primary feature, where need to poll the GPS over an extended period of time. Everything works fine when we install via build&run in Xcode, but whenever its installed via adhoc using hockey (ipa generated using build&archive->share_application->distribute_for_enterprise), something very odd is going on with CoreLocation. Here are the problems we're experiencing; (1) the "Allow xxx to access your current location" dialog is never displayed, (2) the location icon on the taskbar is never shown, and (3) the delegate method, locationManager:didUpdateToLocation... is never called.
To make matters even more confusing, this issue is only reproducible on the developer devices. Beta testers are not experiencing this. We have tried removing all provisioning profiles from the developer devices and from Xcode, but the issue still remains. We have also verified that we are building with the lastest provisioning profile. I was only able to install via adhoc onto my dev phone after I completely wiped it and set it up as a new phone in iTunes.
Has anyone else experienced this issue or something similar? Any suggestions/recommendations?
Tested using Xcode 3.2.4 64bit and iOS 4.1 (8B117)
Possibly related to iphone Location Services code that works on OS 4.1 in appstore?

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

Iphone - deprecated funcions... will they crash the iphone?

I am dealing with an old code designed for iPhone OS 2.0. In this code I have some instructions that we deprecated on iPhone 3.0.
I am not willing to change the version because I have many customers, specially on iPod Touch, that are still using 2.0. If I update the instructions they will be unable to continue receiving the updates.
The application is compiled for 2.0 and always have been like that.
I have submitted a new version for Apple, where some bugs were corrected and new functionality was added. I have always sent this app to apple and they never complained. Now they rejected the application telling me that it is crashing under OS 3.1.3.
I've followed their instructions but I don't see any crash and the part of the code that uses the "deprecated" function works perfectly on 3.1.3.
Compiling the project for 3.1.3, I see a yellow warning on Xcode telling me that one instruction was deprecated on 3.1.3.
The big question is: will this instruction work on 3.1.3 and should I ignore this warning?
Can this make the iPhone crash?
In my mind, all new versions of the iPhone OS keeps back compatibility with older versions, so, as I think, any application compiled for 2.0 will run on 3.1.3 and all versions up.
As you see, I have tested this on 3.1.3 and the application works perfectly.
How can that be? Any ideas?
thanks for any help.
Deprecated calls are designed to work in the OS release that they became deprecated in, but stop working in some (undefined) future OS. The deprecation is a warning to developers: Hey, you should change your code, this WILL break in the future. It's a way to update the API-base without breaking everyone.
In summary, you're okay to use these calls now, but you'll want to edit the code should you ever decide to ditch 2.x operability.

Developing for 2.2.1 SDK on Snow Leopard

I’ve installed Snow Leopard, have Xcode 3.2 and 3.0 iPhone SDK. I want my applications to run on 2.2.1, but the SDK is nowhere to be found in Xcode. I’ve set the deploy target to 2.2.1, but still I cannot be sure I am not using any 3.0-isms. (I’ve sent a sample application to my friend who still has 2.2.1 and it does not run, so it looks I really do use some 3.0 specific API.) How can make sure that my applications will run on 2.2.1? (Simulator also lists only 3.0 as version option.) I’d hate to check my sources manually for every call that might not have existed in 2.2.1.
See my question.
However, I think this is a bad situation that Apple has created for us. There really is no way to test against 2.x.x, if you, like me, have no iPhone 2.2s to test against. I actually bought a new 3Gs just so I could use the old 3G for testing. Stupidly though, when iTunes came up one day and asked if I wanted my phone updated to 3.0.1, I said yes, without realizing which phone I was updating.
I have tried, to no avail, to downgrade to 2.2.1, doing all the things like holding the home button and power for 10 seconds, etc., but I keep getting a baseband loading error.
I know Apple is trying hard to push everyone to 3.0, but not having the stats on how many users are still on the older OS, it seems prudent to keep supporting that OS. They should at least have kept 2.2.x support for the Simulator. I hate to release a 2.2.1 app based on whether I think I am using 3.0 calls or not, without actually testing it on 2.2.1.
OK, SDK 3.1 was released yesterday (September 9) and also contains SDK 2.2.1. You cannot build for the Simulator, only for the device, but most of the glaring 3.0-isms will appear as compile errors, which makes testing much easier.
Uninstall the SDK or Developer folder completley.
using Terminal execute: /Library/uninstall-devtools --mode=all, then restart, re-install new SDK.