-
Notifications
You must be signed in to change notification settings - Fork 8
Version 1.6.0 don't work with cocoapods. (Offline MBTiles) #578
Comments
Can you check to see if your code is setting the access token? Here is the property you should set https://www.mapbox.com/mapbox-ios-sdk/api/Classes/RMConfiguration.html#//api/name/accessToken |
No, my code isn't setting the access token since the app is completely offline. Just for the record this works great with version 1.5.X and ask me for a token when using 1.6.0 I try to describe an isolated scenario.
Just the same project. One with binary distribution and one using cocoapods. |
Is accesstoken now required for offline tiles ? |
Two issues here:
I believe a token shouldn't be required for offline tiles, this seems like a small remnant of API v4 support from before we could rely on Map/RMMapboxSource.m (L361-L364): + (BOOL)isUsingLargeTiles
{
return ([[RMConfiguration sharedInstance] accessToken] && [[UIScreen mainScreen] scale] > 1.0);
} Here's the crash stack: 2015-03-10 15:15:52.384 MB Example[2937:6142484] *** Assertion failure in -[RMConfiguration accessToken], /Users/jason/Documents/Mapbox/mapbox-ios-example-master/Pods/Mapbox-iOS-SDK/MapView/Map/RMConfiguration.m:140
2015-03-10 15:15:52.391 MB Example[2937:6142484] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An access token is required in order to use the Mapbox API. Obtain a token on your Mapbox account page at https://www.mapbox.com/account/apps/.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107474b95 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010710cbb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001074749fa +[NSException raise:format:arguments:] + 106
3 Foundation 0x00000001057d5b0f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 MB Example 0x000000010510c263 -[RMConfiguration accessToken] + 195
5 MB Example 0x000000010514a6a9 +[RMMapboxSource isUsingLargeTiles] + 73
6 MB Example 0x000000010513847d -[RMMapView setTileSourcesMinZoom:] + 157
7 MB Example 0x0000000105125014 -[RMMapView performInitializationWithTilesource:centerCoordinate:zoomLevel:maxZoomLevel:minZoomLevel:backgroundImage:] + 3028
8 MB Example 0x0000000105125d28 -[RMMapView initWithFrame:andTilesource:centerCoordinate:zoomLevel:maxZoomLevel:minZoomLevel:backgroundImage:] + 408
9 MB Example 0x0000000105125b46 -[RMMapView initWithFrame:andTilesource:] + 198
10 MB Example 0x00000001050d0816 -[OfflineLayerViewController viewDidLoad] + 326
11 UIKit 0x0000000105f7bb60 -[UIViewController loadViewIfRequired] + 738
12 UIKit 0x0000000105f7bd5e -[UIViewController view] + 27
13 UIKit 0x0000000105fc007f -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 360
14 UIKit 0x0000000105fbc22a -[UITabBarController _setSelectedViewController:] + 311
15 UIKit 0x0000000105ec3aae +[UIView(Animation) performWithoutAnimation:] + 65
16 UIKit 0x0000000105fbbb12 -[UITabBarController _setViewControllers:animated:] + 3105
17 MB Example 0x00000001050d0304 -[AppDelegate application:didFinishLaunchingWithOptions:] + 1652
18 UIKit 0x0000000105e469a8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 240
19 UIKit 0x0000000105e475b7 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2540
20 UIKit 0x0000000105e4a38e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
21 UIKit 0x0000000105e4928c -[UIApplication workspaceDidEndTransaction:] + 179
22 FrontBoardServices 0x0000000109d65f85 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
23 CoreFoundation 0x00000001073a849c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
24 CoreFoundation 0x000000010739e1e5 __CFRunLoopDoBlocks + 341
25 CoreFoundation 0x000000010739dfa5 __CFRunLoopRun + 2389
26 CoreFoundation 0x000000010739d3e6 CFRunLoopRunSpecific + 470
27 UIKit 0x0000000105e48cf9 -[UIApplication _run] + 413
28 UIKit 0x0000000105e4bab0 UIApplicationMain + 1282
29 MB Example 0x00000001050cfc5f main + 111
30 libdyld.dylib 0x00000001079ad145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) |
#578: Unrequire access token for large tiles
No, but this may have been an unintentional change. Will investigate. |
Actually, yes, let's just go with requiring an access token for all uses of The base CocoaPods issue remains here though, so will address. |
What should i do then if i only use the offline MBTile support ? |
That would work fine if you remember to set it valid again if/when you ever need online tiles. |
Yes, i just have tested it and it works just fine without troubles. Upgraded Mapbox from 1.4.1 to 1.6.0 and cocoapods 0.35 to 0.36 and that was the only issue. Thanks. |
But when I have my device in plane mode or without connectivity, I can't load my offline maps... Setting a random string to the access token doesn't fix this issue. |
I have just solved this issue. You have to make a downgrade of cocoapods from 0.36.x to 0.36. With this command "sudo gem uninstall cocoapods", you will see all installed versions and you have to choose the 0.36.x versions. |
…to release # By Justin R. Miller (12) and others # Via Jason Wray (3) and others * 'release' of https://github.com/mapbox/mapbox-ios-sdk: Strengthen GL language, add Swift Offline example update private header matches bump podspec version updated changelog for 1.6.1 explicit public headers in podspec explicit module name podpsec formatting improvements refs #580: pare down Proj4 headers to barest needed for CocoaPods refs #580: properly find CocoaPods-based resource bundle Smooth edges of user location annotation icon's shadow ensure access token is set for v4 API access update link #578: Unrequire access token for large tiles fixes #601: catch bad token during development fixes #581: properly check for valid offline source Add NSLocationAlwaysUsageDescription check to assert
I just try to upgrade one of my projects to the latest version released (1.6.0) and it stops working raising an exception.
The isolated scenario is simple. I start a new project, install mapbox trough cocoapods, write the most basic code to start running a simple map and an exception is raised at the RMConfiguration file
Then i download the mapbox-ios-sdk sample and update the mapbox binary library to the 1.6.0 version (the example is using 1.5.0) and everything works fine, even with the same simple code to render a map. The problem happens when using cocoapods.
I'm using the the offline mbtiles feature (in the official example the offline layer - 2nd tab).
Running the latest stable XCode 6.1.1 and the latest stable cocoapods 0.35
The text was updated successfully, but these errors were encountered: