rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.24k stars 842 forks source link

iOS 8.1.0-rc: Xcode 'Archive' produces a corrupt archive #1097

Closed sampok closed 3 years ago

sampok commented 3 years ago

Describe the bug iOS: Xcode 'Archive' produces a corrupt archive. Seems to be possibly related to iOS Mapbox SDK 5.8. Found a workaround, see below.

To Reproduce

Expected behavior Expecting to be able to build an Archive for App Store submission.

Screenshots

Screen Shot 2020-11-03 at 10 27 14 AM

Versions

Possible reason & Workaround

mfazekas commented 3 years ago

I've added a fix #1262

Note that it requires Podfile modification - see https://github.com/react-native-mapbox-gl/maps/pull/1262#issue-584279625

ansarikhurshid786 commented 3 years ago
[!] An error occurred while processing the pre-install hook of the Podfile.

undefined method `pre_install' for nil:NilClass
mfazekas commented 3 years ago

[!] An error occurred while processing the pre-install hook of the Podfile.

undefined method `pre_install' for nil:NilClass

Which version of @react-native-mapbox-gl/maps are you using. This is only fixed on #masterso you should be using that.

ansarikhurshid786 commented 3 years ago

react-native-mapbox-gl@8.1.0

mfazekas commented 3 years ago

react-native-mapbox-gl@8.1.0

Please use #master or 8.2.0-beta1 I've just published beta1

SebiVPS commented 3 years ago

hi @mfazekas ! i got the same problem, that i can't make a release build on iOS. If i use 8.2.0-beta1 i can successfully create an archive now, but when i try to distribute the app (ad hoc) and create an ipa file i got the following error:

ipatool failed with an exception: #<CmdSpec::NonZeroExitException: $ /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool -v -t /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk -o /var/folders/vc/5cybcdsd7zn7v1mbng40wx7h0000gp/T/ipatool20210308-39679-1g67m4s/thinned-out/arm64/Payload/MyApp.app/Frameworks/Mapbox.framework/Mapbox --generate-dsym /var/folders/vc/5cybcdsd7zn7v1mbng40wx7h0000gp/T/ipatool20210308-39679-1g67m4s/thinned-out/arm64/Payload/MyApp.app/Frameworks/Mapbox.framework/Mapbox.dSYM --strip-swift-symbols /var/folders/vc/5cybcdsd7zn7v1mbng40wx7h0000gp/T/ipatool20210308-39679-1g67m4s/thinned-in/arm64/Payload/MyApp.app/Frameworks/Mapbox.framework/Mapbox Status: pid 40300 exit 1 Stdout:

At Pod installation i recognized the following:

Installing react-native-mapbox-gl 8.2.0-beta1 (was 8.1.0) Removing @react-native-mapbox-gl-mapbox-static

The package @react-native-mapbox-gl-mapbox-static was removed is that intended?

In commandline distribution i got ah huge error log, maybe this one is helpful: MapboxMobileEvents not found in dylib search path

Can you confirm a similar problem? Do you have a solution for this? Thank you very much for your help!

Alaa-Ben commented 3 years ago

Same issue as @SebiVPS ! archive builds and available but error when uploading to app store:

ITMS-90562: Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

mfazekas commented 3 years ago

@Alaa-Ben, @SebiVPS what is the MPGL version used?!

SebiVPS commented 3 years ago

@Alaa-Ben, @SebiVPS what is the MPGL version used?!

The latest version you mentioned above: "@react-native-mapbox-gl/maps": "^8.2.0-beta1"

mfazekas commented 3 years ago

I meant if you have $ReactNativeMapboxGLIOSVersion = '~> 6.3', or similar in your Podfile. If not please try with that too.

janicduplessis commented 3 years ago

@SebiVPS One way to verify the fix work is check if MapboxMobileEvents is actually being included as a framework per my comment here https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-788180364.

Maybe it doesn't work with certain cocoapod version? What version are you using?

RobertSasak commented 3 years ago

I would like to again bring attention to comment by @sampok https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-722498863 This one line resolved all the issues with corrupted archives while still using "@react-native-mapbox-gl/maps": "8.1.0",

$ReactNativeMapboxGLIOSVersion = '~> 6.2.1'

I can only confirm that 6.2.2 or 6.3.3 version have still issue with corrupted archive.

SebiVPS commented 3 years ago

Thank you for your comments, i tried using gem 'cocoapods', '~> 1.9.3' and $ReactNativeMapboxGLIOSVersion = '~> 6.2.1' in Podfile

Currently i get an error at pod install, looks like a temporarily issue at server side, i'll try again tomorrow:

[!] Error installing @react-native-mapbox-gl-mapbox-static
[!] /usr/bin/curl -f -L -o /var/folders/vc/5cybcdsd7zn7v1mbng40wx7h0000gp/T/d20210308-54315-1bh2bgn/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/6.2.1/mapbox-ios-sdk-dynamic-with-events.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.9.3 cocoapods-downloader/1.4.0'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 401 Unauthorized
Alaa-Ben commented 3 years ago

Hmm upgrading cocoapods to 1.10.2, upgrading mapboxgl to 8.2.0-beta1 and adding pre and post install methods in podfile solved this for me.

RobertSasak commented 3 years ago

@SebiVPS In order to use new Mapbox SDK you need to have a special password in .netrc. Please refer to Mapbox iOS SDK fo more info.

# Add Mapbox password to .netrc in order to download iOS SDK
echo -e "machine $NETRC_MAPBOX_MACHINE\nlogin $NETRC_MAPBOX_LOGIN\npassword $NETRC_MAPBOX_PASSWORD" > ~/.netrc
janicduplessis commented 3 years ago

I tested this patch on cocoapods 1.10.x so maybe it doesn't work on 1.9.x. Maybe it is possible to get it to work on 1.9.x or document the requirement of using 1.10.x

SebiVPS commented 3 years ago

Thank you for pointing me in the right direction :) I got it to work with cocoapods v1.10.1, and "@react-native-mapbox-gl/maps": "^8.2.0-beta1" and adding pre and post install methods in Podfile.

bdtren commented 3 years ago

I've added a fix #1262

Note that it requires Podfile modification - see #1262 (comment)

Dear @mfazekas, I tried this solution. Archive and build success. But I cannot upload the archived version to App Store, because of the MapboxMobileEvents

Error:

ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'App.app/Frameworks/MapboxMobileEvents.framework/MapboxMobileEvents' is not permitted. 
Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. 
Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
gregogalante commented 3 years ago

I'm getting the same problem of @bdtren with 8.2.0-beta1 version and the pre_install and post_install tasks on my Podfile

NathanNovak commented 3 years ago

Thank you for pointing me in the right direction :) I got it to work with cocoapods v1.10.1, and "@react-native-mapbox-gl/maps": "^8.2.0-beta1" and adding pre and post install methods in Podfile.

I get a corrupt archive and keep getting this error when trying to upgrade to 8.2.0-beta1:

npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.6.1" from @react-native-mapbox-gl/maps@8.2.0-beta1 npm ERR! node_modules/@react-native-mapbox-gl/maps npm ERR! @react-native-mapbox-gl/maps@"8.2.0-beta1" from the root project

"react": "17.0.1",
"react-native": "0.64.0",

Can someone let me know how to solve this.

abakhtiar commented 3 years ago

I have the same corrupted archive problem with "@react-native-mapbox-gl/maps": "^8.1.0-beta.1". Upgrading to latest versions also breaks my build for hooks dependancies. It is really a big mess in our apps! :(
"react": "16.8.6", "react-native": "0.60.5", Anybody knows a way please let me know. Thanks

NathanNovak commented 3 years ago

@SebiVPS How did you get 8.2.0-beta1 to install on yours?

SebiVPS commented 3 years ago

@NathanNovak

@SebiVPS How did you get 8.2.0-beta1 to install on yours?

there is nothing special here, just add the specific version in your package.json and install. (No login needed) But i still use "react-native" : "0.63.4", maybe there is a problem with 0.64 and react v17 ?

NathanNovak commented 3 years ago

@SebiVPS Thats is the key difference right there. React had a rather large changelog with 17.0.0.

Does anyone know if using '--legacy-peer-deps' flag creates havoc?

Update: I was able to archive and create the .ipa file by using the master version in package.json:

"@react-native-mapbox-gl/maps": "github:react-native-mapbox-gl/maps#master", with the flag --legacy-peer-deps

I also added:

    $RNMBGL.pre_install(installer)
  end

  post_install do |installer|
    $RNMBGL.post_install(installer)
  end

as per @mfazekas suggestion.

So far this works with

"react": "17.0.1",
"react-native": "0.64.0",
designervoid commented 3 years ago

Same issue

designervoid commented 3 years ago

Fixed by upgrading from "@react-native-mapbox-gl/maps": "^8.1.0", to "@react-native-mapbox-gl/maps": "^8.2.0-beta1",. Need to define pre_install and post_install in your ios/Podfile. Then yarn install, npx pod-install. And now I can see archived build in organizer.

b3hz4d commented 3 years ago

I did all the above solution with clean installation but I'm getting this error Info.plist: No such file or directory Any idea how to solve it? Using cocoapods V1.10.1 & Xcode 12.4

ghadeeraqraa1992 commented 3 years ago

I did all the above solution with clean installation but I'm getting this error Info.plist: No such file or directory Any idea how to solve it? Using cocoapods V1.10.1 & Xcode 12.4

I have the same issue did you solve it ?

Hless commented 3 years ago

@ghadeeraqraa1992 Similar thing happend to me out of the blue, you may want to try the following thread: https://github.com/mapbox/mapbox-gl-native-ios/issues/555

Edit: ahhh nevermind, you already found that one

ghadeeraqraa1992 commented 3 years ago

@ghadeeraqraa1992 Similar thing happend to me out of the blue, you may want to try the following thread: mapbox/mapbox-gl-native-ios#555

Edit: ahhh nevermind, you already found that one

did you find a solution ?