How-to Fix: The application-identifier entitlement is not formatted correctly

A new error has started showing up when submitting iPhone Apps through iTunes Connect:

“The application-identifier entitlement is not formatted correctly; it should contain your 10-character App ID Seed, followed by a dot, followed by your bundle identifier.”

From what I can tell, the way to fix this to create a NEW entitlements file (see my previous post on creating adhoc builds for instructions on how to do this).  Previously we’d only had to create an entitlements file and uncheck “get-task-allow”.

However now it appears you also need to add a new “keychain-access-group” and add an item which includes your App Identifier (get this from the iTunes Provisioning Portal) and your bundle identifier (com.mycompany.bundle_name).

See an example below:

How To: iPhone SDK – Play and Record Audio concurrently

Unfortunately, it’s quite a fiddly process to record audio and play it back at the same time on the iPhone.  By default, the sound output is very quiet from the iPhone’s speaker when you are recording sound.  So how do we fix this?

First, setup your audio session to record audio:

NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
   [NSNumber numberWithFloat: 44100.0],                 AVSampleRateKey,
   [NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
   [NSNumber numberWithInt: 1],                         AVNumberOfChannelsKey,
   [NSNumber numberWithInt: AVAudioQualityMax],         AVEncoderAudioQualityKey, nil];

recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
if (recorder) {
   [recorder prepareToRecord]; 
   recorder.meteringEnabled = YES;
   [recorder record]; 
} else {
   NSLog(@"Error: %@", error);
}

Then tell the device you want to record and play audio at the same time:

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = nil;
[audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:&err];

Then, and this is the key, allow the volume from the speakers to also be loud when recording:

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,
sizeof(audioRouteOverride),&audioRouteOverride);

The end result? You can happily play audio at full volume while recording from the device’s microphone. Happy days.

Facebook Connect Mobile: XML Schema Error on Mobile Devices

If you’re getting an XML error when you’re using Facebook Connect to post to a users stream using the function:

$facebook->render_prompt_feed_url()

Then ensure the following:

  • You don’t have any double quotes in your attachment
  • You don’t have any ampersands in your return URL

For some reason the content is being placed in a hidden field on the page on “mobile” devices.  This isn’t escaping the contents of the post, and hence breaks if you have any of the above.

Highly frustrating!  Hope this helps someone.

New iPhone: Torch, Flash and Front/Rear cameras?


After the recent release to developers of iPhone SDK 4.0, the inevitable scramble to review the new APIs has been on in earnest.  One of the first things noticed were the following new AVCaptureDevice class properties:

  • AVCaptureDevice – isFlashMode Supported
  • AVCaptureDevice – isTorchMode Supported
  • AVCaptureDevice – position (Front or Rear)

These new properties relating to the iPhone SDK class AVCaptureDevice, a class used for audio and video capture and management, suggest that the new iPhone (to be announced at WWDC 2010??) may well include a “Flash”, a “Torch” and a front camera.

If this was to turn out to be true, then a front camera for the phone would make video calls possible, the ability to take photos while viewing the camera feed, and the flash would allow you to take photos in the dark!

All very cool new potential features.  Let’s keep our fingers crossed that this turns out to be the case!