Error building project with PG 2.1

  • 1
  • Problem
  • Updated 8 years ago
With the following setup:

XCode to 4.5.1 + Updated simulators (iPhone 6.0 Simulator)
Phonegap 2.1.0

I have used the ./create command from the phonegap tools to create my project.
The problem is that when I try and build the project (either directly in XCode or using the cordova/debug command) I get an error:

/Applications/Cordova/lib/ios/CordovaLib/Classes/CDVContacts.m:82:5: error: 'release' is unavailable: not available in automatic reference counting mode
dispatch_release(workQueue);

The above is what I pulled from the log and its the same that XCode picks up. I'm thinking that iOS 6 requires ARC and using dispatch_release it not allowed.

Anyway, commenting out that line of code in the dealloc method of the CDVContacts.m file:

-(void) dealloc
{
//dispatch_release(workQueue);
}

solves the problem.

I don't to what effect commenting out this line will affect the app, but I thought I should mention this.
Photo of Milo Jasper

Milo Jasper

  • 18 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 1
Photo of Milo Jasper

Milo Jasper

  • 18 Posts
  • 0 Reply Likes
Also, the project created from ./create command seems to set the deployment target of the project to iOS 4.2. This is true for both the project and its sub CordovaLib.xcodeproj project.

I have change these manually in XCode to iOS 6.0.

My question is, why is this not preset to iOS 6.0 with PhoneGap 2.1?
Photo of Taskstrike

Taskstrike

  • 2 Posts
  • 0 Reply Likes
I have the same problem, why is there even ARC incompatible stuff in the latest version
Photo of Milo Jasper

Milo Jasper

  • 18 Posts
  • 0 Reply Likes
Taskstrike, did you uncomment the 'dispatch_release(workQueue);' line?

Did it solve your problem?
Photo of Taskstrike

Taskstrike

  • 2 Posts
  • 0 Reply Likes
yeah that fixed it
Photo of Andrew Lunny

Andrew Lunny

  • 1911 Posts
  • 199 Reply Likes
Hey guys,

I've forwarded your problem to the Cordova iOS team - hopefully they can get back to you quickly.
Photo of Shazron

Shazron, Developer Level 42

  • 37 Posts
  • 2 Reply Likes
I downloaded the 2.1 source, created a new project and it built fine on iOS 6. I checked the new project - it does not use ARC which is by design. CordovaLib itself does use ARC however which is not a problem with mixing the two.

This was done for plugin compatibility reasons.
Photo of Milo Jasper

Milo Jasper

  • 18 Posts
  • 0 Reply Likes
Hi shazron,

Yes that CDVContacts.m file is part of the sub CordovaLib project.

So what do think I should do as a solution? Comment out that line like I have done? Or did you mean you have updated the 2.1 source and I should redownload it?
Photo of Shazron

Shazron, Developer Level 42

  • 37 Posts
  • 2 Reply Likes
Milo,
The line was in 2.1.0, but it compiled ok for me using the same environment. If you download the latest code, it has since been removed due to another bug fix: https://github.com/apache/incubator-c...
Photo of Milo Jasper

Milo Jasper

  • 18 Posts
  • 0 Reply Likes
Thanks shazron. However, I would rather keep using the stable 2.1.0 version with my solution than use the unstable incubator. I will update when it becomes stable.