Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Bundle Structure #28

Closed
bwalpoleuk opened this issue Apr 2, 2019 · 9 comments
Closed

Invalid Bundle Structure #28

bwalpoleuk opened this issue Apr 2, 2019 · 9 comments

Comments

@bwalpoleuk
Copy link

In an attempt to find a workaround for the issue described here #26 I've modified my AzureDevOps build to re-sign the application after the initial build.

This has got me a bit further so I've added the code to create the SwiftSupport folder, however when I submit builds to Apple I get the following error:

ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'MyApp.app/SwiftSupport/libswiftCore.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles.

This is a bit confusing as I thought the whole point was that the Swift libraries had to be in that folder?

At the moment I'm still just testing the build process so the Swift Core NuGet package is the only one I'm pulling in.

@Flash3001
Copy link
Owner

Hey @bwalpoleuk the SwiftSupport folder needs to be outside your MyApp.app, but inside your MyApp.IPA.

MyApp.IPA/Payload/MyApp.app
MyApp.IPA/SwiftSupport/libswiftCore.dylib

@bwalpoleuk
Copy link
Author

@Flash3001 Thanks I'd missed that point, I can now upload a build but I get an error after it finishes processing:

Invalid Swift Support - The files libswiftCore.dylib don’t match /Payload/MyApp.app/Frameworks/libswiftCore.dylib. Make sure the files are correct, rebuild your app, and resubmit it. Don’t apply post-processing to /Payload/MyApp.app/Frameworks/libswiftCore.dylib.

@Flash3001
Copy link
Owner

Flash3001 commented Apr 2, 2019

I was struggling with the same error since yesterday for the new version of the library (for Swift 5).

Please do a lipo LIBPATH -detailed_info for both libswiftCore.dylib on Frameworks and SwiftSupport and share the result.

Also, how are you creating the SwiftSuport folder?

@Flash3001
Copy link
Owner

I updated the script I use to generate that folder, see if helps you: https://github.com/Flash3001/ipa-packager/blob/master/package_ipa_default.sh

@bwalpoleuk
Copy link
Author

I had to make a tweak at line 29:

mkdir -p "${TEMP_IPA_BUILT}/Payload/${APP}"
cp -Rp "${APP}" "${TEMP_IPA_BUILT}/Payload/${APP}"

Otherwise I was getting:

ERROR ITMS-90017: "This bundle is invalid. The IPA format requires a top-level directory named Payload, containing only a .app bundle and optional plugins in a Plugins directory."

Unfortunately now I'm back to the original error.

Below is the lipo output:

Swift Support:

Fat header in: /Users/Me/Downloads/MyApp/SwiftSupport/iphoneos/libswiftCore.dylib fat_magic 0xcafebabe nfat_arch 3 architecture armv7 cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 offset 16384 size 22736656 align 2^14 (16384) architecture armv7s cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7S offset 22757376 size 22769232 align 2^14 (16384) architecture arm64 cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL offset 45531136 size 24280192 align 2^14 (16384)

Frameworks:

Fat header in: /Users/Me/Downloads/MyApp/Payload/MyApp.app/Frameworks/libswiftCore.dylib fat_magic 0xcafebabe nfat_arch 3 architecture armv7 cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 offset 16384 size 22744992 align 2^14 (16384) architecture armv7s cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7S offset 22773760 size 22777616 align 2^14 (16384) architecture arm64 cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL offset 45563904 size 24288544 align 2^14 (16384)

@Flash3001
Copy link
Owner

I had to make a tweak at line 29:

mkdir -p "${TEMP_IPA_BUILT}/Payload/${APP}"
cp -Rp "${APP}" "${TEMP_IPA_BUILT}/Payload/${APP}"

How are you running the command? it should be something like sh package_ipa.sh full_path_to_old_path_to.app full_path_to_new.ipa

Like: sh package_ipa '/Users/flash/Desktop/Payload/SuasVendasIOS.app' '/Users/flash/Desktop/YS.Mobile.iOS.ipa'

Otherwise I was getting:

ERROR ITMS-90017: "This bundle is invalid. The IPA format requires a top-level directory named Payload, containing only a .app bundle and optional plugins in a Plugins directory."

Unfortunately now I'm back to the original error.

That being Invalid Bundle Structure?

Below is the lipo output:

Swift Support:

Fat header in: /Users/Me/Downloads/MyApp/SwiftSupport/iphoneos/libswiftCore.dylib fat_magic 0xcafebabe nfat_arch 3 architecture armv7 cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 offset 16384 size 22736656 align 2^14 (16384) architecture armv7s cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7S offset 22757376 size 22769232 align 2^14 (16384) architecture arm64 cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL offset 45531136 size 24280192 align 2^14 (16384)

Frameworks:

Fat header in: /Users/Me/Downloads/MyApp/Payload/MyApp.app/Frameworks/libswiftCore.dylib fat_magic 0xcafebabe nfat_arch 3 architecture armv7 cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 offset 16384 size 22744992 align 2^14 (16384) architecture armv7s cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7S offset 22773760 size 22777616 align 2^14 (16384) architecture arm64 cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL offset 45563904 size 24288544 align 2^14 (16384)

Is this output from when? After you run the script I provided? When you got the Invalid Bundle error or from now after you changed line 29?

I imagine it is after running the updated script as now the dylibs archs on SwiftSupport match the ones in Frameworks. What happens after you submit this version?

@bwalpoleuk
Copy link
Author

@Flash3001 Sorry I wasn't clear in my explanation.

Without the tweak to the script I got the ERROR ITMS-90017 error because the .app folder was missing from the .ipa.

I ended up with:
MyApp.ipa
->SwiftSupport/
->Payload/
->->All the app files

After the tweak I was able to successfully upload the build but after processing I returned to the error below:

Invalid Swift Support - The files libswiftCore.dylib don’t match /Payload/MyApp.app/Frameworks/libswiftCore.dylib. Make sure the files are correct, rebuild your app, and resubmit it. Don’t apply post-processing to /Payload/MyApp.app/Frameworks/libswiftCore.dylib.

The lipo output I included is from the build that produced the Invalid Swift Support error above.

@Flash3001
Copy link
Owner

@bwalpoleuk this issue is quite intriguing. I had the same issue and matching the architectures did solve the problem. The remaining thing would be to check if the original files are indeed the same by checking the version. I was looking at the original thread on #26 and you said you tried with 4.2.1 and 4.2.0 (#26 (comment)). Which is the one you are using now? If you are using Xcode 10.1 you should be using version 4.2.1.

In any case, you can try another approach altogether. This week I release Xamarin.Swift 1.0.1. It is very different from the way the previous versions work, you don't have to install a bunch of packages and it will figure out which dylibs to include. It also checks if the version is valid and adds the files to SwiftSupport if your build is generating the IPA (there is a configuration on VS for that). https://www.nuget.org/packages/Xamarin.Swift/

@bwalpoleuk
Copy link
Author

@Flash3001 Yes you were right I was still using the 4.2.0 packages, after upgrading to 4.2.1 the updated script seems to be working as I've been able to successfully upload a build to iTunes.

Thanks for your help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants