Emre Önder
Emre Önder

Reputation: 2537

ERROR ITMS-90171: "Invalid Bundle Structure The binary file MyApp.app/libswiftRemoteMirror.dylib is not permitted

I'm getting below error when trying to upload my ipa which is build on Jenkins.

ERROR ITMS-90171: "Invalid Bundle Structure - The binary file 'ideaPitch.app/libswiftRemoteMirror.dylib' is not permitted. Your app can’t contain standalone executables or libraries, other than the 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."

How I get the ipa on Jenkins

   /usr/bin/xcodebuild -list -workspace My_App.xcworkspace
   /usr/bin/xcodebuild -scheme My_App -workspace My_App.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR=${WORKSPACE}/build -UseModernBuildSystem=0
   /usr/bin/xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/build/My_App.app" -o ${WORKSPACE}/build/My_App${PRODUCT_VERSION}-${PRODUCT_VERSION}.ipa

   ditto -c -k --keepParent -rsrc "${WORKSPACE}/build/My_App.app.dSYM" ${WORKSPACE}/build/My_App-${PRODUCT_VERSION}-${PRODUCT_VERSION}-dSYM.zip

When I get the ipa on Xcode, everything works fine. However, I need to do it on Jenkins. What can cause this problem? Thank you.

EDIT I searched SO and found some posts (like below one). However, I need to find out which line or code this problem so I can't just directly copy and paste the answer. So please don't mark it as duplicate.

ERROR ITMS-90171: "Invalid Bundle Structure The binary file APP.app/libswiftRemoteMirror.dylib is not permitted

Upvotes: 1

Views: 962

Answers (1)

Emre Önder
Emre Önder

Reputation: 2537

The problem was getting the build and then iPA from It. As I searched, the correct path was archiving the project and then get iPA from the archive with xcodebuild.

The correct two line of code is;

 /usr/bin/xcodebuild -quiet -workspace ${workspaceName} -scheme ${schemeName} -sdk iphoneos -configuration Release archive -archivePath ${WORKSPACE}/build/${appName}.xcarchive
 /usr/bin/xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/${appName}.xcarchive -exportOptionsPlist My_Project_Main_Folder/Resources/${environment}/${environment}_ExportOptions.plist -exportPath ${WORKSPACE}/build

P.S: There is a difference between PackageApplication and Xcodebuild. Xcodebuild needs an export options plist file which tells Xcodebuild, what options does it use like Certificate, Provisioning file and Bitcode Support etc..

Example Export Options Plist File:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>compileBitcode</key>
    <false/>
    <key>destination</key>
    <string>export</string>
    <key>method</key>
    <string>development</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>com.iamdeveloper.myapp.dev</key>
        <string>My App Development Provision</string>
    </dict>
    <key>signingCertificate</key>
    <string>iPhone Developer</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>XXXXXXXXXX</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>

Upvotes: 0

Related Questions