Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

{Map}[Style]: Failed to load [mapbox://mapbox.mapbox-streets-v6]: #2012

Closed
desduvauchelle opened this issue Aug 7, 2015 · 18 comments
Closed
Labels
Milestone

Comments

@desduvauchelle
Copy link

Just installed MapboxGL through cocoapods. I initialize it in my ViewController like the example given:

 @IBOutlet weak var mapViewWrapper: UIView!

    var mapView: MGLMapView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Map
        let styleURL = NSURL(string: "asset://styles/dark-v7.json")
        mapView = MGLMapView(frame: mapViewWrapper.bounds, styleURL: styleURL)
        mapView.autoresizingMask = .FlexibleWidth | .FlexibleHeight

        // set the map's center coordinate
        mapView.setCenterCoordinate(CLLocationCoordinate2D(latitude: 38.894368,
            longitude: -77.036487),
            zoomLevel: 15, animated: false)
        mapViewWrapper.addSubview(mapView)
    }

When I launch the app, I see a black square and a Mapbox logo but no streets, see image below enter image description here:
Image of map

In the logs I'm getting this:

[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-streets-v6]: 
[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-terrain-v2]: 

Any ideas what I did wrong?

@picciano
Copy link

picciano commented Aug 8, 2015

I have several users (including myself) reporting the same thing in our app. Something has gone terribly wrong. We are building from source from master.

This seems to happen consistently on the first launch following a uninstall/reinstall, but also seems to happen after the app has been running a while.

@picciano
Copy link

This issue has been plaguing us all weekend.
The map often goes black when switching back and forth between apps as well as after a clean install. I have recreated this problem with the demo app. See attached, the map goes black at the end (last 10 seconds), but the compass still turns when performing the rotate gesture. There are no error messages or warnings in the console.

Screen capture from iPhone 5s: http://www.filedropper.com/appgoesblack

@picciano
Copy link

Rolling back this commit seems to get rid of the "black screen of death", but does leave a flicker when coming back from background. Seems to be related to view.invalidate() not always getting called.

9fd7e88

@friedbunny
Copy link
Contributor

@desduvauchelle Are you using MapboxGL in the podspec or are you pointing at our git prereleases?

We've seen this internally as well, starting last week. @brunoabinader's refactoring in #1979 does appear to be the likely cause.

@friedbunny friedbunny added the bug label Aug 10, 2015
@brunoabinader
Copy link
Member

Could you please check this against patch from #2026 that got in yesterday?

@desduvauchelle
Copy link
Author

@friedbunny I just have this in my podfile pod 'MapboxGL'

@picciano
Copy link

@brunoabinader I am still seeing the issue. Patch #2026 may have reduced the frequency of it showing up especially during app switching. I still see it happen occasionally after a clean app install.

@kylebrowning
Copy link

This is still happening.

@jamcar23
Copy link

I also can't load a map style using Mapbox iOS SDK.

[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-streets-v6]: 
[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.satellite]: 
[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-terrain-v2]: 

@kylebrowning
Copy link

I was able to load them today.

Using cocoa pods version

pod --version
0.38.2

And my pod file

platform :ios, '8.0'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'Parse'
pod 'ParseUI'
pod 'ParseFacebookUtils'
pod 'pop'
pod 'Mapbox-iOS-SDK'

I had to remove use frameworks! even though I'm building for iOS 8, but the project would just not build without removing the line.

so the normal pod install and wait.

Once I did that, the following worked

#import "ViewController.h"
#import "Mapbox.h"

@interface ViewController ()

@property (nonatomic) MGLMapView *mapView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // initialize the map view
    self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds];
    self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    // set the map's center coordinate
    [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(38.894368, -77.036487)
                       zoomLevel:15
                        animated:NO];
    [self.view addSubview:self.mapView];
}

@end

@ristkof
Copy link

ristkof commented Oct 16, 2015

I think I've done everything required, double checked it all, but still I get:

2015-10-16 09:49:53.040 playground-winterinapen[5806:1671178] [ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6]: 

Is there anybody with the sample project as a zip that I can just paste my access token in to check if it is in my setup or server side? (Xcode 7.0.1, Simulator)

@friedbunny
Copy link
Contributor

This appears to be multiple issues. For those first starting out, this is likely caused by a cached bad access token. Delete the app from your test device/simulator, make sure your token is correct, and then try again.

The case where this can happen with a known-good token on an already-installed app is probably also a caching issue of some sort, but I have not been able to reproduce it.

@friedbunny
Copy link
Contributor

The "bad access token" problem here happens because we cache mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6.json?secure no matter the response status, which comes with a 12 hour expires tag.

Even if the access token is immediately corrected, subsequent requests are reloaded from the poisoned cache that only cares about the stripped canonical URL (which has an Error status and won't be checked again for 12 hours).

This problem is obscured by how we deal in response statuses (Error, Successful, or NotFound are the options), which results in a vague error message.

/cc @kkaefer @1ec5

@AdamBCo
Copy link

AdamBCo commented Oct 31, 2015

Some of these issues could be caused by the failure to copy and paste the correct API access token.

I noticed this through no fault of my own, but if one tries to copy and paste the access token by highlighting it, then they will most likely lose the tail end of the string.

The only way to ensure that one copies the correct access token is to use the button on the dashboard, which should be made clearer.

It would also be helpful if the MapBox iOS SDK notified developers of an invalid access token.

@kylebrowning
Copy link

While that may be the case for some Adam. That is not what happened to me.

On Oct 31, 2015, at 4:08 PM, Adam Cooper notifications@github.com wrote:

Some of these issues could be caused by the failure to copy and paste the correct API access token.

If one doesn't copy the Access token by clicking the Clipboard icon on the dashboard, then they will run into the following issue.

It would be helpful if the MapBox iOS SDK notified developers of an incorrect access token.


Reply to this email directly or view it on GitHub.

1ec5 added a commit that referenced this issue Nov 3, 2015
Just in case browser weirdness or a tendency to triple-click-select is causing some cases of #2012.
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
Just in case browser weirdness or a tendency to triple-click-select is causing some cases of mapbox#2012.
@tmcw
Copy link
Contributor

tmcw commented Nov 10, 2015

The "bad access token" problem here happens because we cache mapbox://v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6.json?secure no matter the response status, which comes with a 12 hour expires tag.

Could we include the access token with the cache key to avoid this issue?

@friedbunny
Copy link
Contributor

Could we include the access token with the cache key to avoid this issue?

@kkaefer would know for sure, but I think we genericize/canonicalize these URLs for cache efficiency. I don't think changing access tokens within a single app is a common use case, so that may be the way to fix this.

@friedbunny
Copy link
Contributor

Fixed by #3479.

@friedbunny friedbunny added this to the ios-v3.1.0 milestone Jan 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants