mapbox / MapboxStatic.swift

Static map snapshots with overlays in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
https://www.mapbox.com/api-documentation/?language=Swift#static
Other
189 stars 31 forks source link

Bundle is damaged or missing necessary resources #56

Closed AustinoBombino closed 7 years ago

AustinoBombino commented 7 years ago

I've been able to make the standard mapbox gl for macos work with my application, but am having an issue with the static sdk.

I built the xcode project and put the resulting framework in my target's link binary with libraries section.

Upon running the program I get a message saying the bundle is damaged or missing necessary resources, so I tried to add a copy files for the framework to the target as well as an appropriate runpath, but the problem persists.

The only difference that I can see between the static framework and the standard one in my target directory is that the static is missing a _codesign folder. Could this be part of the issue or am I looking in the wrong direction?

frederoni commented 7 years ago

Swift frameworks like MapboxStatic.swift has to be dynamic but I assume you refer to the MapboxStatic framework and not a static type of framework. You should drop the framework in "Embedded binaries" instead of "Linked binaries and libraries". Doing this will make the framework appear in both panes and the issue you're seeing should go away.

AustinoBombino commented 7 years ago

My build has multiple targets that I thought had to link to the framework, but only one is a .app. I placed the framework in 'embedded binaries' for the .app target and in 'linked binaries and libraries' and 'copy files' for the other, which is the only setup that worked for the mapbox gl macos sdk. I just tried again with the framework only referenced in the .app 'embedded binaries' and it's working now. Thanks.

AustinoBombino commented 7 years ago

I spoke too soon, if I try to use any of the mapboxstatic classes, the non-.app target throws an error for a bad reference, but if I include the framework in its linked libraries, the bundle will fail to load.

frederoni commented 7 years ago

Ok, frameworks can't embed other frameworks but linking against them should work. Can you paste the error message here?

AustinoBombino commented 7 years ago

Unable to load PlugIn: FCPXAudioVisualizerXPC due to error: 3587, The bundle “FCPXAudioVisualizer” couldn’t be loaded because it is damaged or missing necessary resources..

We went through this with the mapbox gl macos sdk at https://github.com/mapbox/mapbox-gl-native/issues/8632 and the fix was to both link against the mapbox.framework and add a copy files build phase for it.

AustinoBombino commented 7 years ago

Under my target's build options "Always Embed Swift Standard Libraries" was set to no. I changed it to yes and the program runs successfully.