Search code examples
objective-ciosios4google-drive-apigoogle-api-objc-client

Google APIs Client Library doesn't compile for iOS 4.3


I'm integrating Google Drive API with my iOS drive following the steps on https://developers.google.com/drive/quickstart-ios It works on iOS>=5.0. But if I change the target of the GTL project to 4.3, it fails with the errors:

/google-api-objectivec-client-read-only/Source/Utilities/GTLJSONParser.m:87:20: Multiple methods named 'dataWithJSONObject:options:error:' found

/google-api-objectivec-client-read-only/Source/Utilities/GTLJSONParser.m:127:32: Multiple methods named 'JSONObjectWithData:options:error:' found

If I don't set the target to 4.3, it has the error:

Symbol not found: _OBJC_CLASS_$_NSJSONSerialization Referenced from: .....

On the download page http://code.google.com/p/google-api-objectivec-client/ it says the library is compatible with applications built for iOS 3 and later. So anyone knows what is going wrong?


Solution

  • When the GTL library is built for iOS 4.x, it expects to also have SBJSON classes compiled into the target, as the system's JSON parser, NSJSONSerialization, was introduced in iOS 5. The SBJSON classes are checked out with the other library sources, but are not by default included in the library project, as not many projects support iOS 4 anymore.

    Look at GTLJSONParser for details of how the library parses JSON on different versions of iOS.