Category Archives: iOS

Submit to App Store Using XCode 4.4.1 With iPhone 5 Supported

There are still lots of iOS 4.0 ~ 4.2 iOS devices. So we do need to support iOS 4.0-4.2 devices besides the latest iPhone 5. But there are problems for supporting both of them.

Before Oct 2012, you can add 4-inch launching image to your app, compile using XCode 4.4.1 and submit to App Store, your App will get reviewed with iPhone 5 supported. That was good for both Apple and developers. Beginning with Oct 2012, App Store will reject such apps submitted in such a way, saying:

Dear developer,

We have discovered one or more issues with your recent delivery for “####”. To process your delivery, the following issues must be corrected:

Invalid?Launch Image?- Your app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later.

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

It seems that App Store is trying to force those Apps to support iOS 4.3~6.0 only, leaving those old iOS devices behind (Hey, you should buy our latest iPhone 5! – by Apple).

To support iPhone 5, you need to compile your App under XCode 4.5+. But using XCode 4.5+, only iOS 4.3+ are supported. Using XCode 4.4.1 and earlier, your submitted App with iPhone 5 launch image will get marked as “Invalid Launch Image”.

After searching and testing for one or two days, I figured out the following way:

1. Archive your App under XCode 4.5
2. Open Organizer, show your App folder in Finder and enter App’s Products/Applications folder, copy Info.plist and archived-expanded-entitlements.xcent to somewhere else, like your home folder.
2.5 Open your Info.plist (~/Info.plist) using XCode, and modify MinimumOSVersion from 4.3 to 4.0 [Updated: Nov 19, 2012]
3. Close XCode 4.5 and open XCode 4.4.1, open your App project and open your Target’s “Build Phrases” tab, add a Run Script, with shell “/bin/sh” and “cp -f ~/Info.plist ~/archived-expanded-entitlements.xcent “${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app”
4. Re-archive your App, and it should pass App Store’s rule checker and in “Waiting for review” soon.

I have submitted an App in late October, it got online in early November. So it should be working for at least a month or so.

The reason behind these steps is that Info.plist contains the base SDK version and other configuration information. We use Info.plist modified by XCode 4.5, re-compile the app using XCode 4.4.1 and code-sign it with modified Info.plist, so App Store considered it as an App built by XCode 4.5 basing on iOS 6.0 and the given launch image for iPhone 5 is valid. While XCode 4.4.1 supports compiling for armv6 and armv7 CPU instructions that is required for those old iOS 4.0~4.2 devices, we supports all iOS 4.0+ devices ?in such a way.

Hope the above steps help. Let me if it is working for you or not.

P.S. :?Someone used XCode 4.3.2 and submitted his App to App Store successfully in this way. So XCode 4.x should be working in this way.

Posted in iOS | 6 Comments

Fixed: AVAudioPlayer Only Play 1-2s in iOS 6

I am developing Coco Voice ( http://cocovoice.com/ ) these days. After updating to iOS 6, no matter iOS 6 beta 4, iOS GM or iOS 6.0 release, I found that AAC-encoded voice message could not be played correctly. Only 1~2 seconds of voice was played even though the message was far longer than 2 seconds. But if I set currentTime to >= 1.4s, it will play the whole message after the given currentTime value. In this case, we always lose the first seconds message. Unacceptable for a voice mobile IM.

Searching the web, it seems only a few guys met with this problem. Someone explained that the duration is incorrect for AAC-encoded voice data. And some of them said they have reported this bug to Apple already (but I could not find the bug report). iOS 6.0 was just released yesterday or so, it may take at least a month or so for iOS 6.0.1 for this bug-fix. So we won’t just wait.

After lots of try, here is the solution:

AVAudioPlayer *soundPlayer = [[AVAudioPlayer alloc] initWithData:message error:&err];
soundPlayer.volume = 1.0f;
soundPlayer.currentTime = soundPlayer.duration + soundPlayer.duration;
soundPlayer.numberOfLoops = 1;
[soundPlayer setDelegate:self];
[soundPlayer prepareToPlay];
[soundPlayer play];

Just set currentTime to the end of the message and tell player to play the message twice. So it will be correctly played once. And set double duration to currentTime will make sure that player does not play the end of message twice.

BTW: If you set currentTime to 1.4f, and then NSLog the currentTime, you will find out that it will be changed to a different value.

Posted in iOS, Objective-C | 2 Comments