Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps SDK for iOS trying to run on iOS 4.3

I successfully integrated the sdk with my app. My app is intended to run with Google Maps sdk for iOS6, and with Apple UIMapKit for iOS 4.3 and 5.x . Since I added the google maps framework, ios 4.3 won't run anymore. I changed the GLKit.framework and GoogleMaps.framework to "optional", and I get dyld: Symbol not found: _NSFileProtectionCompleteUntilFirstUserAuthentication before the app even starts. need your help :-)

like image 631
tomeron11 Avatar asked Oct 22 '22 21:10

tomeron11


1 Answers

My app runs okay on iOS 4.3, with GLKit.framework and GoogleMaps.framework set to optional, and if I remove all calls to the Google API.

Could the reference to NSFileProtectionCompleteUntilFirstUserAuthentication be caused by some of your other code or other frameworks?

UPDATE:

Actually the above is wrong. I had forgotten to include the -ObjC linker flag in step 7 of the instructions. Without the -ObjC the app is able to run fine on iOS 4.3. Without the -ObjC flag on iOS 6 the call to [GMSServices provideAPIKey] succeeds, but the call to [GMSMapView mapWithFrame:camera:] fails silently (returns nil), so this isn't an option.

With the -ObjC flag in place, on iOS 4.3 I get the same error about _NSFileProtectionCompleteUntilFirstUserAuthentication.

I tried changing -ObjC to -force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps, to only force loading of the Google Maps API and not other libraries, but it still fails on iOS 4.3.

I presume that the -ObjC or -force_load are overriding the setting to make GoogleMaps.framework optional.

Also, on iOS 5.0 I get a similar error about _NSURLIsExcludedFromBackupKey. I'm presuming it would work on iOS 5.1, though. @tomeron11, what version of 5.x were you testing with?

UPDATE 2:

It feels like a horrible hack, but adding the following to one of the .m files in the project allows it to work on iOS 5.0:

NSString* const NSURLIsExcludedFromBackupKey = @"NSURLIsExcludedFromBackupKey";

This doesn't seem to cause a problem on iOS 6.0, even though the symbol will have been defined twice, although I'm not sure if it can be trusted.

For iOS 4.3 I tried doing the equivalent, by adding:

NSString* const NSFileProtectionCompleteUntilFirstUserAuthentication = 
    @"NSFileProtectionCompleteUntilFirstUserAuthentication";

This stops the error about _NSFileProtectionCompleteUntilFirstUserAuthentication, but then I get the following error instead:

dyld: Symbol not found: _OBJC_CLASS_$_NSMutableOrderedSet

I'm not sure if there is a way to fool the linker into seeing a dummy version of NSMutableOrderedSet on iOS 4.3.

UPDATE 3:

The SDK documentation says that the minimum supported platform is iOS 5.1.

Google have closed the bug report as WontFix, so it seems there will be no way to get it to work on 5.0 or below.

UPDATE 4:

Google have reopened the bug as an Enhancement.

UPDATE 5:

The latest version 1.1.0 of the SDK now no longer crashes on startup on iOS 5.0.

However, Google will not be fixing the crash on iOS 4.x.

Since the SDK only officially supports iOS 5.1+, although it no longer crashes on startup on iOS 5.0, if you try to create a GMSMapView then it crashes with an error message:

Google Maps SDK for iOS only supports iOS 5.1+

If you use the hack which used to make it not crash on startup on 5.0, ie this:

NSString* const NSURLIsExcludedFromBackupKey = @"NSURLIsExcludedFromBackupKey";

Then the SDK will run on iOS 5.0. It seems to work, but it's probably not a good idea, as it is not officially supported by Google.

like image 143
Saxon Druce Avatar answered Oct 27 '22 12:10

Saxon Druce