导出 ios 应用程序时出错
Posted
技术标签:
【中文标题】导出 ios 应用程序时出错【英文标题】:Getting error while exporting ios app 【发布时间】:2017-02-24 21:57:54 【问题描述】:当我尝试导出应用程序时,使用 IBM MobileFirst 8 支持的 Hybrid Cordova 6.5 应用程序出现以下错误:
2017-02-24 21:54:40 +0000 [MT] Failed to generate distribution items with error: Error Domain=DVTMachOErrorDomain Code=0 "Found an unexpected Mach-O header code: 0x72613c21" UserInfo=NSLocalizedDescription=Found an unexpected Mach-O header code: 0x72613c21, NSLocalizedRecoverySuggestion=
2017-02-24 21:54:40 +0000 [MT] Presenting: Error Domain=DVTMachOErrorDomain Code=0 "Found an unexpected Mach-O header code: 0x72613c21" UserInfo=NSLocalizedDescription=Found an unexpected Mach-O header code: 0x72613c21, NSLocalizedRecoverySuggestion=
2017-02-24 22:05:30 +0000 [MT] Beginning distribution assistant for archive: App Name, task: Validate
2017-02-24 22:05:30 +0000 [MT] Automatically selecting the only availaable distribution method <IDEDistributionMethodiosAppStoreValidation: 0x7f8ca08aefb0>
2017-02-24 22:05:31 +0000 [MT] [OPTIONAL] Didn't find archived user entitlements for <DVTFilePath:0x7f8c9f9ad2b0:'/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundation.framework'>: Error Domain=NSCocoaErrorDomain Code=4 "Item at "/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundation.framework" did not contain a "archived-expanded-entitlements.xcent" resource." UserInfo=NSLocalizedDescription=Item at "/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundation.framework" did not contain a "archived-expanded-entitlements.xcent" resource.
2017-02-24 22:05:31 +0000 [MT] [OPTIONAL] Didn't find archived user entitlements for <DVTFilePath:0x7f8ca0a58e60:'/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundationPush.framework'>: Error Domain=NSCocoaErrorDomain Code=4 "Item at "/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundationPush.framework" did not contain a "archived-expanded-entitlements.xcent" resource." UserInfo=NSLocalizedDescription=Item at "/Users/ptiwari/Library/Developer/Xcode/Archives/2017-02-24/App Name 2-24-17, 4.05 PM.xcarchive/Products/Applications/App Name.app/Frameworks/IBMMobileFirstPlatformFoundationPush.framework" did not contain a "archived-expanded-entitlements.xcent" resource.
2017-02-24 22:05:35 +0000 [MT] Canceled distribution assistant
【问题讨论】:
我在导出项目时遇到同样的错误。我在添加 cordova-plugin-mfp-push@~8.0.2017012410 插件后开始得到它。如果我删除这个插件,我没有错误。 您尝试过下面提供的解决方案吗? 哪一个?我不想完全删除平台,因为我有一些自定义本机修改 我只是在另一个问题上解释了我的错误和所有日志:***.com/questions/44250159/… 就我而言...删除并重新添加平台解决了问题。 【参考方案1】:我很确定这与以下内容有关:https://mobilefirstplatform.ibmcloud.com/blog/2016/10/17/prepare-ios-apps-for-app-store-submission/
-
在 Xcode 项目设置中选择 Build Phases 选项卡
添加新的运行脚本阶段
将以下脚本粘贴到“运行脚本”选项卡中
APP_PATH="$TARGET_BUILD_DIR/$WRAPPER_NAME"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: $ARCHS"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "$EXTRACTED_ARCHS[@]"
rm "$EXTRACTED_ARCHS[@]"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
【讨论】:
同理,添加shell脚本后问题未解决。添加 mfp-push 插件后出现问题 当我删除 cordova-plugin-mfp-push 时,我可以导出构建,当我添加 cordova-plugin-mfp-push 插件 (cordova-plugin-mfp-push@~8.0.2017012410 ),我无法导出构建并且我有提到的错误【参考方案2】:我删除了所有的 cordova 插件并重新添加了它们。然后我删除了ios平台并再次添加它。然后我打开xcode再次尝试导出我的应用程序,导出成功。
【讨论】:
【参考方案3】:您是否使用任何第三方 SDK。设置这个。
https://github.com/CocoaPods/CocoaPods/issues/4450
【讨论】:
我使用的唯一第三方 SDK 是 IBMMobileFirstPlatformFoundation.framework 和 IBMMobileFirstPlatformFoundationPush.framework以上是关于导出 ios 应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章
Flash Builder iOS 导出发布错误 Invalid format versionLabel