sg-ueno / google-api-objectivec-client

Automatically exported from code.google.com/p/google-api-objectivec-client
0 stars 1 forks source link

Causes crash on iOS 5.1 #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Set build scheme in Xcode 4.6 to iOS 5.1 iPhone Simulator (or use an iOS 5.1 
device)

2. Include code in a basic iOS app to initialize GTMOAuth2Authentication object 
via the init method:

+ (id)authenticationWithServiceProvider:(NSString *)serviceProvider
                               tokenURL:(NSURL *)tokenURL
                            redirectURI:(NSString *)redirectURI
                               clientID:(NSString *)clientID
                           clientSecret:(NSString *)clientSecret

3. Set a breakpoint at line 200 in GTMOAuth2Authentication.m, inside the 
aforementioned method, the line there should be "obj.serviceProvider = 
serviceProvider;"

4. Launch your app in iOS 5.1 Simulator or on an iOS Device and trigger the 
creation of the authentication object above.

5. When you hit the breakpoint, attempt to step to the next instruction, 
obj.tokenURL = tokenURL;

What is the expected output? What do you see instead?

Well, setting the property should go as you'd expect, and if you tell the 
debugger to continue, a  GTMOAuth2Authentication object should be created (and 
this works fine on iOS 6). Instead, when "obj.tokenURL = tokenURL;" is 
executed, you get the following hard crash output with no backtrace (because 
it's a runtime issue, I believe):

dyld: lazy symbol binding failed: Symbol not found: 
_objc_setProperty_atomic_copy
  Referenced from: /Users/billy/Library/Application Support/iPhone Simulator/5.1/Applications/74270074-AC83-495F-87E1-6A1923713EE6/Strip.app/Strip
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation

This kind of crash can usually be fixed by ensuring that the property in 
question has a corresponding ivar declaration, linked via @synthesize. This 
already appears to be the case with the tokenURL property, so I'm not sure why 
it's blowing up. The value of the incoming tokenURL parameter is 
"https://accounts.google.com/o/oauth2/token," so that does not appear to be the 
problem, either.

What version of the product are you using? On what operating system?

SVN checkout of google-api-objectivec-client-read-only, latest date listed in 
the ReleaseNotes.txt is dated 6-Dec-2012.

Please provide any additional information below.

Happy to provide further info, relevant build settings. The following is how 
I'm creating the GTMOAuth2Authentication object in my view controller's 
viewDidLoad method, which works just fine in iOS 6 as mentioned above:

    // Check for authorization.
    GTMOAuth2Authentication *auth =
    [GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:kGoogleDriveKeychainItemName
                                                          clientID:kGoogleDriveClientId
                                                      clientSecret:kGoogleDriveClientSecret];

Original issue reported on code.google.com by wg...@zetetic.net on 11 Mar 2013 at 6:35

GoogleCodeExporter commented 9 years ago
Your project's target in Xcode should have a deployment target setting of 5.1.

See for example 
http://stackoverflow.com/questions/12404495/xcode-4-5-error-on-ios-5 and 
http://stackoverflow.com/questions/12641190/arc-app-crashes-when-accessing-prope
rty-form-arc-static-lib

Original comment by grobb...@google.com on 12 Mar 2013 at 12:34

GoogleCodeExporter commented 9 years ago
Hi there,

Thanks for the response! Xcode 4.6 supports a deployment target of iOS 4.3, 
which is what we use at Zetetic for STRIP. Just to confirm, is a deployment 
target of iOS 5.1 the earliest supported by the client library?

Thanks!
Billy Gray

Original comment by wg...@zetetic.net on 12 Mar 2013 at 2:31

GoogleCodeExporter commented 9 years ago
The library was originally written for 4.3 compatibility. As far as we know, it 
still should work with 4.3 so long as the appropriate JSON parser code is 
compiled in, but it's been years since we've even tried building for 4.3, and 
we're not aware of any developers nowadays targeting 4.3 for their iOS apps.

Original comment by grobb...@google.com on 13 Mar 2013 at 6:14

GoogleCodeExporter commented 9 years ago
Thanks again for the information. I did give it a shot; for anybody else who 
runs into this, or is searching for an answer:

For now it looks like this library is not compatible with iOS 4.3 and requires 
a minimum deployment target of 5.1 to build. Building with the deployment 
target on GTL.xcodeproj set to 4.3 fails due to duplicate NSJSONSerialization 
declarations generated by the code in GTLJSONParser.m—code that looks like it 
was written with 4.3 compatibility in mind. I made a few lame attempts to 
resolve this but didn't get anywhere. I'm just going to set my app's baseline 
to 5.1, since anybody running 4.3 should be able to upgrade to iOS 5 with their 
armv7 device.

Original comment by wg...@zetetic.net on 13 Mar 2013 at 2:30