microsoftconnect / intune-app-wrapping-tool-ios

This is the software for the Intune App Wrapping Tool for iOS.
55 stars 12 forks source link

InTune crashes when wrapping iOS IPA-File (entitlements?) #89

Closed faken closed 9 months ago

faken commented 2 years ago

Describe the bug: When wrapping my IPA-File InTune is crashing with the following error message:

~/Developer/FaMe/apps-ios-service master* ❯ ./Tools/IntuneMAMPackager/Contents/MacOS/IntuneMAMPackager -i RTL_Order.ipa -o RTL_Order_Wrapped.ipa -p Provisiong_Profiles/FaMe_OrderInHouse.mobileprovision -c "08 31 EB 11 41 E3 68 E1 A9 5C 7B 34 FF 91 7E 2C C8 0B 36 3D" -v
Application packaging in progress...
Version of MACOSX is 12.6.1
Version of XCode installed is Xcode 14.0.1
Build version 14A400

Parsing provisioning profile...
Parsing main app provisioning profile...
Parsing extension provisioning profiles...
Checking that main provisioning profile has not expired...
Checking that extension provisioning profiles have not expired...
Checking if signing certificate is valid...
Provided certificate name length matches that of SHA1 hash.
Number of certificates returned by query: 5
Checking certificate at index: 0
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 1
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 2
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 3
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 4
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Possible fingerprint match found. Checking if certificate is contained in provisioning profile...
Computing SHA-256 fingerprint of certificate.
Checking if SHA-256 hash exists in provisioning profile.
Certificate was found in the provisioning profile.
Checking if certificate issuer is Apple.
Checking if signing certificate is found in each extension profile...
Creating temporary directories...
Input Parameters
 Path to input application:             /Users/saschaheld/Developer/FaMe/apps-ios-service/RTL_Order.ipa
 Path to output application:    /Users/saschaheld/Developer/FaMe/apps-ios-service/RTL_Order_Wrapped.ipa
 Provisioning profile:                  Provisiong_Profiles/FaMe_OrderInHouse.mobileprovision
 Certificate:           08 31 EB 11 41 E3 68 E1 A9 5C 7B 34 FF 91 7E 2C C8 0B 36 3D
2022-11-23 15:14:48.571 IntuneMAMPackager[77360:1797462] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString hasPrefix:]: nil argument'
*** First throw call stack:
(
        0   CoreFoundation                      0x00000001a2c91148 __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x00000001a29dbe04 objc_exception_throw + 60
        2   CoreFoundation                      0x00000001a2d6316c -[__NSCFString characterAtIndex:].cold.1 + 0
        3   CoreFoundation                      0x00000001a2d63208 -[__NSCFString hasSuffix:].cold.1 + 0
        4   CoreFoundation                      0x00000001a2bd3b1c -[__NSArrayM countByEnumeratingWithState:objects:count:] + 0
        5   IntuneMAMPackager                   0x00000001002dbd50 +[CMAPUtility replaceIfStartsWith:replaceFrom:replaceTo:] + 76
        6   IntuneMAMPackager                   0x00000001002dfa80 -[CMAPEntitlementsParser updateApplicationIdentifiersWithNewAppId:newAppIdPrefix:oldBundleIdPrefix:newBundleIdPrefix:error:] + 692
        7   IntuneMAMPackager                   0x00000001002d670c -[CMAPPackager generateEntitlementsFile:dstDir:missingEntitlements:parser:entitlementsFile:bundleId:app:error:] + 1828
        8   IntuneMAMPackager                   0x00000001002cca78 -[CMAPPackager createEntitlementsFileWithError:message:] + 340
        9   IntuneMAMPackager                   0x00000001002c7970 -[CMAPPackager createPackage] + 1244
        10  IntuneMAMPackager                   0x00000001002c1ea0 -[CMAPCommandLineDelegate onWrapApplication] + 1116
        11  IntuneMAMPackager                   0x00000001002c0ed8 -[CMAPCommandLineDelegate mainFunction] + 2432
        12  IntuneMAMPackager                   0x00000001002db144 main + 72
        13  dyld                                0x000000010056508c start + 520
)
libc++abi: terminating with uncaught exception of type NSException
[1]    77360 abort      ./Tools/IntuneMAMPackager/Contents/MacOS/IntuneMAMPackager -i RTL_Order.ipa -
~/Developer/FaMe/apps-ios-service master* ❯ 

The IPA is signed as an enterprise build with the same provisioning profile I am passing to InTune. There are no special entitlements enabled for the IPA-file. What am I doing wrong?

jamgarci-MSFT commented 2 years ago

@faken not sure if this is the cause, but you are missing true after the flag -v

faken commented 2 years ago

I've already tried it with -v true and -e to strip the entitlements. Still having the same issue:

~/Developer/FaMe/apps-ios-service master* ❯ ./Tools/IntuneMAMPackager/Contents/MacOS/IntuneMAMPackager -i RTL_Order.ipa -o RTL_Order_Wrapped.ipa -p Provisiong_Profiles/FaMe_OrderInHouse.mobileprovision -c "08 31 EB 11 41 E3 68 E1 A9 5C 7B 34 FF 91 7E 2C C8 0B 36 3D" -v true -e
Application packaging in progress...
Version of MACOSX is 12.6.1
Version of XCode installed is Xcode 14.0.1
Build version 14A400

Parsing provisioning profile...
Parsing main app provisioning profile...
Parsing extension provisioning profiles...
Checking that main provisioning profile has not expired...
Checking that extension provisioning profiles have not expired...
Checking if signing certificate is valid...
Provided certificate name length matches that of SHA1 hash.
Number of certificates returned by query: 5
Checking certificate at index: 0
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 1
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 2
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 3
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Checking certificate at index: 4
Getting certificate common name.
Computing SHA-1 fingerprint of current certificate.
Computing SHA-1 fingerprint of provided certificate.
Possible fingerprint match found. Checking if certificate is contained in provisioning profile...
Computing SHA-256 fingerprint of certificate.
Checking if SHA-256 hash exists in provisioning profile.
Certificate was found in the provisioning profile.
Checking if certificate issuer is Apple.
Checking if signing certificate is found in each extension profile...
Creating temporary directories...
Input Parameters
 Path to input application:             /Users/saschaheld/Developer/FaMe/apps-ios-service/RTL_Order.ipa
 Path to output application:    /Users/saschaheld/Developer/FaMe/apps-ios-service/RTL_Order_Wrapped.ipa
 Provisioning profile:                  Provisiong_Profiles/FaMe_OrderInHouse.mobileprovision
 Certificate:           08 31 EB 11 41 E3 68 E1 A9 5C 7B 34 FF 91 7E 2C C8 0B 36 3D
2022-11-23 15:52:28.741 IntuneMAMPackager[78433:1819836] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString hasPrefix:]: nil argument'
*** First throw call stack:
(
        0   CoreFoundation                      0x00000001a2c91148 __exceptionPreprocess + 240
        1   libobjc.A.dylib                     0x00000001a29dbe04 objc_exception_throw + 60
        2   CoreFoundation                      0x00000001a2d6316c -[__NSCFString characterAtIndex:].cold.1 + 0
        3   CoreFoundation                      0x00000001a2d63208 -[__NSCFString hasSuffix:].cold.1 + 0
        4   CoreFoundation                      0x00000001a2bd3b1c -[__NSArrayM countByEnumeratingWithState:objects:count:] + 0
        5   IntuneMAMPackager                   0x00000001000bfd50 +[CMAPUtility replaceIfStartsWith:replaceFrom:replaceTo:] + 76
        6   IntuneMAMPackager                   0x00000001000c3a80 -[CMAPEntitlementsParser updateApplicationIdentifiersWithNewAppId:newAppIdPrefix:oldBundleIdPrefix:newBundleIdPrefix:error:] + 692
        7   IntuneMAMPackager                   0x00000001000ba70c -[CMAPPackager generateEntitlementsFile:dstDir:missingEntitlements:parser:entitlementsFile:bundleId:app:error:] + 1828
        8   IntuneMAMPackager                   0x00000001000b0a78 -[CMAPPackager createEntitlementsFileWithError:message:] + 340
        9   IntuneMAMPackager                   0x00000001000ab970 -[CMAPPackager createPackage] + 1244
        10  IntuneMAMPackager                   0x00000001000a5ea0 -[CMAPCommandLineDelegate onWrapApplication] + 1116
        11  IntuneMAMPackager                   0x00000001000a4ed8 -[CMAPCommandLineDelegate mainFunction] + 2432
        12  IntuneMAMPackager                   0x00000001000bf144 main + 72
        13  dyld                                0x000000010037108c start + 520
)
libc++abi: terminating with uncaught exception of type NSException
[1]    78433 abort      ./Tools/IntuneMAMPackager/Contents/MacOS/IntuneMAMPackager -i RTL_Order.ipa -
jamgarci-MSFT commented 2 years ago

Oh you are not alone see #88

faken commented 2 years ago

But actually looking at the stack trace, the cause for the issue looks to be something else. @jamgarci-MSFT

jamgarci-MSFT commented 2 years ago

What version of the wrapping tool are you using?

faken commented 2 years ago

I am using this version: Microsoft Intune App Wrapping Tool for iOS Version:17.1.1

vigavadi commented 2 years ago

@faken Would you be willing to share an unwrapped version of the app? If so, can you send it to vigavadi@microsoft.com? I'll try to wrap it on my end.

faken commented 2 years ago

@vigavadi I've send you an E-Mail with the IPA-File.

vigavadi commented 2 years ago

@faken Thanks! I'll take a look

vigavadi commented 2 years ago

@faken The input app needs to be signed before attempting to wrap it. Is this app already signed? Here are the prerequisites: General prerequisites for the app wrapping tool

ShruthiAchutha commented 9 months ago

Closing stale issues. Please reopen if you still need help with this.