SBJson not using ARC-compatible branch #182

Closed
weefbellington opened this Issue Mar 20, 2012 · 20 comments

Projects

None yet

6 participants

@weefbellington

It looks like the current version of SBJson available through CocoaPods isn't using the ARC-compatible branch. I get the following build errors:

MyProjectName/Pods/Headers/SBJson/SBJsonStreamParser.h
Property attributes 'assign' and 'weak' are mutually exclusive

MyProjectName/Pods/Headers/SBJson/SBJsonStreamWriter.h
Property attributes 'assign' and 'weak' are mutually exclusive

These look fixed on the ARC branch on Github.

@alloy
CocoaPods member

Although we could add a spec for the v3.1alpha3 tag, it might be an idea to ask the author if he wants to release 3.1. (As it has been 5 months ago.) Until 3.1 is released, though, I think it's best we wait to see if many more people run into this issue.

As a workaround you can create your own spec repo and have a 3.1alpha3 spec or in any of the ways described under ‘Install libraries from anywhere’

@weefbellington

I'll see if I can ping the author on this one.

@stig

Google alerts beat you too it. I'll try to get a v3.1 release out.

@alloy
CocoaPods member

@stig Hahaha, nice one. Thanks.

@stig
@alloy
CocoaPods member

@stig Thanks!

@weefbellington Will you add a spec for v3.1?

@rburger

Any update on the office v3.1 release?

@alloy
CocoaPods member
@alloy alloy closed this Apr 19, 2012
@pcasaretto

Hey guys,
Im pretty confused on this ARC/non-ARC compatibility stuff.

My Podfile looks like this

platform :ios, :deployment_target => '4.0'

dependency 'SBJSon'

Which gives me SBJson 3.1 (ARC).
But when I run my app on the simulator running iOS 4.3 , I get an error because iOS 4 does not know anything about ARC.
I'm at work right now, and I can't give any more details. As soon as I get home ill work on example project to replicate this behavior.

@pcasaretto

Finnaly,

the error I got was

dyld: lazy symbol binding failed: Symbol not found: _objc_storeStrong
  Referenced from: /Users/pcasaretto/Library/Application Support/iPhone Simulator/4.3.2/Applications/3176C53F-9D12-4157-B4C7-9314F95733DC/cocoapodstest.app/cocoapodstest
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

dyld: Symbol not found: _objc_storeStrong
  Referenced from: /Users/pcasaretto/Library/Application Support/iPhone Simulator/4.3.2/Applications/3176C53F-9D12-4157-B4C7-9314F95733DC/cocoapodstest.app/cocoapodstest
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

Is this expected? Am I being dumb?
I've pushed the project to this repo https://github.com/pcasaretto/cocoapods-crash .

@siuying

If your project is not already using ARC, you'll need to add linker flag '-fobjc-arc' to force it include ARC library. details: http://stackoverflow.com/questions/8756418/static-library-with-arc-support-linked-to-non-arc-project-causing-linker-errors

@stig

That error indicates that it does use the ARC-enabled version of SBJson, but that is not supported by default by iOS 4.3 I believe. From Apple's Transitioning To ARC docs:

Use Compiler Flags to Enable and Disable ARC
You enable ARC using a new -fobjc-arc compiler flag. You can also choose to use ARC on a per-file basis if it’s more convenient for you to use manual reference counting for some files. For projects that employ ARC as the default approach, you can disable ARC for a specific file using a new -fno-objc-arc compiler flag for that file.

ARC is supported in Xcode 4.2 for Mac OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5. Weak references are not supported in Mac OS X v10.6 and iOS 4. There is no ARC support in Xcode 4.1 and earlier.

@pcasaretto

And that is not cocoapods responsabilty?

@siuying

@pcasaretto it is and it should have been done (#142). but does manually add the linker flag fix your issue?

@pcasaretto

@siuying Just tested and it did.
But it is unclear to me how would the app behave on a device running iOS < 4.3 .

@siuying

ARC work on iOS 4.x, you just would not get weak referencing support.

@alloy
CocoaPods member

@siuying iirc the forced addition of that linker flag was reverted, as it turned out to be a bug that was fixed with newer Xcode versions. YMMV.

@siuying

@alloy thank you!

@pcasaretto

@alloy Thats strange, I have version 4.3.2 and it worked. But anyway, if that was a bug, is this a dead end? Will cocoapods deliver a project that does not work?

@alloy
CocoaPods member

@pcasaretto See the discussion on http://stackoverflow.com/questions/8756418/static-library-with-arc-support-linked-to-non-arc-project-causing-linker-errors, which is referenced from #142. Some people see it on 4.3.2, some don’t…

Anyhow, the workaround for the Xcode/LLVM bug has not been removed, but simply disabled by default. As noted in the commit message, you can turn it on with the set_arc_compatibility_flag! method in your Podfile.

@kylef kylef pushed a commit that referenced this issue Feb 18, 2014
@alloy alloy Add SBJson 3.1. Closes #182. 62b277c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment