diff --git a/install/hooks/ios/after-plugin-install.js b/install/hooks/ios/after-plugin-install.js index 743f3bc..79d09df 100644 --- a/install/hooks/ios/after-plugin-install.js +++ b/install/hooks/ios/after-plugin-install.js @@ -104,6 +104,32 @@ find "$CODESIGNING_FOLDER_PATH/www/nodejs-project/" -name "*.framework" -type d ); } + //Adds a build phase to remove the x64 strips from the NodeMobile framework. Needed for correct App Store submission. + var removeSimulatorArchsBuildPhaseName = 'Remove NodeJS Mobile Framework Simulator Strips'; + var removeSimulatorArchsBuildPhaseScript = ` +set -e +FRAMEWORK_BINARY_PATH="$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH/NodeMobile.framework/NodeMobile" +FRAMEWORK_STRIPPED_PATH="$FRAMEWORK_BINARY_PATH-strip" +if [ "$PLATFORM_NAME" != "iphonesimulator" ]; then + if $(lipo "$FRAMEWORK_BINARY_PATH" -verify_arch "x86_64") ; then + lipo -output "$FRAMEWORK_STRIPPED_PATH" -remove "x86_64" "$FRAMEWORK_BINARY_PATH" + rm "$FRAMEWORK_BINARY_PATH" + mv "$FRAMEWORK_STRIPPED_PATH" "$FRAMEWORK_BINARY_PATH" + echo "Removed simulator strip from NodeMobile.framework" + fi +fi +` + var removeSimulatorArchsBuildPhase = xcodeProject.buildPhaseObject('PBXShellScriptBuildPhase', removeSimulatorArchsBuildPhaseName, firstTargetUUID); + if (!removeSimulatorArchsBuildPhase) { + xcodeProject.addBuildPhase( + [], + 'PBXShellScriptBuildPhase', + removeSimulatorArchsBuildPhaseName, + firstTargetUUID, + { shellPath: '/bin/sh', shellScript: removeSimulatorArchsBuildPhaseScript } + ); + } + // Write the changes into the Xcode project. fs.writeFileSync(pbxprojPath, xcodeProject.writeSync()); diff --git a/install/hooks/ios/before-plugin-uninstall.js b/install/hooks/ios/before-plugin-uninstall.js index a2a1666..c369a88 100644 --- a/install/hooks/ios/before-plugin-uninstall.js +++ b/install/hooks/ios/before-plugin-uninstall.js @@ -63,6 +63,13 @@ module.exports = function(context) { xcodeProject.myRemovePbxScriptBuildPhase(signNativeModulesBuildPhaseName, firstTargetUUID); } + // Removes the build phase to strip the simulator strips. + var removeSimulatorArchsBuildPhaseName = 'Remove NodeJS Mobile Framework Simulator Strips'; + var removeSimulatorArchsBuildPhase = xcodeProject.buildPhaseObject('PBXShellScriptBuildPhase', removeSimulatorArchsBuildPhaseName, firstTargetUUID); + if (removeSimulatorArchsBuildPhase) { + xcodeProject.myRemovePbxScriptBuildPhase(removeSimulatorArchsBuildPhaseName, firstTargetUUID); + } + // Write the changes into the Xcode project. fs.writeFileSync(pbxprojPath, xcodeProject.writeSync());