mapbox / mapbox-scenekit

Other
231 stars 51 forks source link

Stop opening "Access tokens" page on every build #13

Closed morgane closed 6 years ago

morgane commented 6 years ago

Every time I build and run the project, it'll open https://www.mapbox.com/account/access-tokens/, even though I've already added my token. It's a minor annoyance and doesn't break anything, but also doesn't need to keep happening.

1ec5 commented 6 years ago

That must mean the token isn’t in the right place or the script isn’t working correctly. Can you confirm that you have the token at either ~/.mapbox or ~/mapbox?

morgane commented 6 years ago

I added it to Info.plist per step #5 here. When I have it there, the app works (ie doesn't complain about lack of a token; maps load just fine) but still opens https://www.mapbox.com/account/access-tokens/.

When I tried the mapbox text file instead, it throws an error in MapboxImageAPI.swift:

"accessToken must be set in the Info.plist as MGLMapboxAccessToken or the Route passed into the RouteController must have the accessToken property set."

morgane commented 6 years ago

For further clarification, this only happens when I go through the "clone the repo" workflow. If I use Carthage instead, I don't have this problem.

1ec5 commented 6 years ago

The Xcode project is following this guide almost exactly. (We just updated the URL that the script opens, but that’s of little consequence here.)

https://github.com/mapbox/mapbox-scenekit/blob/7d0d1a5a3fb37f9ec08a8990710ecada2dd58d60/MapboxSceneKit.xcodeproj/project.pbxproj#L326

I’m unable to reproduce this issue. The logic in the script is quite simple: if the file at ~/.mapbox or ~/mapbox contains any content at all, it sets the application’s access token to the contents of that file. Otherwise, it opens the access token page.

1ec5 commented 6 years ago

This same issue has been reported in mapbox/navigation-ios-examples#23, another repository that uses this script. I’m befuddled.

1ec5 commented 6 years ago

This issue reproduces only after incremental builds in Xcode 12 and above. This guide has been updated to note that $(TARGET_BUILD_DIR)/$(INFOPLIST_PATH) needs to be added to the Run Script build phase’s Input Files list.

1ec5 commented 6 years ago

Actually, that happened in #18.