PhoneGap 1.5.0 and iOS 5.1

Hey All,

Just posting here so I remember some fixes I had to do with the new release of PhoneGap 1.5 (also known as Cordova).

When you initially run your new xCode product, you will get a ton of “semantic” issues.  The fix is to go to Build Settings -> Objective-C  Automatic Reference Counting -> “NO”

I found this clarification from a comment posted by Alejandro Orduz at http://phonegap.com/2012/03/06/phonegap-1-5-released/ 

“ok, i manage to make it work, Cordova, under Xcode 4.3.1…. regarding the www stuff…

First of all, getting into this painful process(more of all because of my lack of knowledge of Xcode), i wen to the process to upgrade my iPhone to the latest iOS 5.1, then had to upgrade Xcode to 4.3.1 to support testing in this device, but also did an upgrade to the latest lion 10.7.3…. so it was a boring weekend of upgrading….

The first time you run a new phone gap project under Cordova, is not like old days, now when you run you get a scary 9 errors warnings about a Semantic Issue in some, NSAutoreleasePool well, for some of us, that is like speaking chinease… but it can be solved very easy… the new Xcode has some Automatic Reference Counting ON by default, so you just go to the project Build Settings, find Objective-C  Automatic Reference Counting and change it to “NO”, after that everything goes to normal…. then it can build, add the www, you get the normal iPhone simulator error, and then, like before, had to drag and drop the www folder into the project root….

Changes like this are very scary for people like me, that found phonegap an amazing tool to build mobile apps with our web development knowledge…. :-{  ”

Also! I finally got the camera example working.  I was receiving a weird “wait_fences: failed to receive reply: 10004003” when I used the Camera example code verbatim.  It would work, but I would only recieve a small blue box on my iPhone.

The issue is that the code on line 40:

smallImage.src = “data:image/jpeg;base64,” + imageData;

is wrong.  PhoneGap 1.5 / iOS 5 stores the taken photo in a temporary directory, so you dont get the base64 data anymore, you have the actual URI for the photo in imageData.  All you need to do is change line 40 to be:

smallImage.src =  imageData;

and it will work.

 

I hope this helps out some people.  It’s working for me, YMMV.

-Shea

6 thoughts on “PhoneGap 1.5.0 and iOS 5.1

  1. – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    UIImage *image = nil;
    if ([mediaType isEqualToString:@”public.image”]) {
    image = [info objectForKey:@”UIImagePickerControllerOriginalImage”];
    }

    if(currentSourceType_ == UIImagePickerControllerSourceTypeCamera) {
    self.wantsFullScreenLayout = NO;
    picker.wantsFullScreenLayout = NO;
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    }
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;

    [cameraPicker_ dismissModalViewControllerAnimated:NO];
    [self dismissModalViewControllerAnimated:NO];
    cameraPicker_.delegate = nil;
    cameraPicker_ = nil;

    [ImageProcessingUtil saveFilterImage:image];
    [self.navigationController popViewControllerAnimated:NO];

    }

    Objective-C Automatic Reference Counting -> “YES”

    I was receiving a weird “wait_fences: failed to receive reply: 10004003″

Leave a Reply to Jérôme Cancel reply

Your email address will not be published. Required fields are marked *