NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 60 forks source link

iOS: Cannot publish app due to unsupported architectures #18

Closed dylanvdmerwe closed 4 years ago

dylanvdmerwe commented 6 years ago

This is something that caught my by surprise. The app with this plugin is denied by Apple.

How do we go about fixing this as soon as possible?

ERROR ITMS-90087: "Unsupported Architectures. The executable for Antel.app/Frameworks/CropViewController.framework contains unsupported architectures '[x86_64, i386]'."
An unknown error occurred.

ERROR ITMS-90087: "Unsupported Architectures. The executable for Antel.app/Frameworks/IRLDocumentScanner.framework contains unsupported architectures '[x86_64, i386]'."
An unknown error occurred.

ERROR ITMS-90087: "Unsupported Architectures. The executable for Antel.app/Frameworks/TOCropViewController.framework contains unsupported architectures '[x86_64, i386]'."
An unknown error occurred.

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Antel.app/Frameworks/CropViewController.framework/CropViewController' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
An unknown error occurred.

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Antel.app/Frameworks/IRLDocumentScanner.framework/IRLDocumentScanner' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
An unknown error occurred.

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Antel.app/Frameworks/TOCropViewController.framework/TOCropViewController' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
An unknown error occurred.

ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."
An unknown error occurred.

WARNING ITMS-90080: "The executable 'Payload/Antel.app/Frameworks/CropViewController.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."
An unknown error occurred.

WARNING ITMS-90080: "The executable 'Payload/Antel.app/Frameworks/IRLDocumentScanner.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."
An unknown error occurred.

WARNING ITMS-90080: "The executable 'Payload/Antel.app/Frameworks/TOCropViewController.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."
An unknown error occurred.

System Info:

System:

    ios-deploy : 1.9.2
    ios-sim    : 6.1.2
    Node       : v8.11.1
    npm        : 5.8.0
    OS         : macOS High Sierra
    Xcode      : Xcode 9.4 Build version 9F1027a
dylanvdmerwe commented 6 years ago

This allows the app to be submitted to the store, but really shouldn't be necessary: http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/

ChrisTomAlx commented 6 years ago

I'm glad you were able to solve this issue. Will see what can be done about this.

Cheers, Chris Neutrinos

toniblagaic commented 5 years ago

I have a similar issue with signing the application. I used http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/ and https://stackoverflow.com/questions/42641806/check-and-remove-unsupported-architecture-x86-64-i386-in-ipa-archive to strip the unwanted arhitectures but the issue stays the same. Please help? { code = 306; description = "Failed to resolve rpath for IRLDocumentScanner: Could not resolve @executable_path for @executable_path/Frameworks from IRLDocumentScanner"; info = { }; level = WARN; }, { code = 330; description = "Failed to resolve linkage dependency IRLDocumentScanner i386 -> @rpath/TOCropViewController.framework/TOCropViewController: Unknown arch i386"; info = { }; level = WARN; }, { code = 306; description = "Failed to resolve rpath for IRLDocumentScanner: Could not resolve @executable_path for @executable_path/Frameworks from IRLDocumentScanner"; info = { }; level = WARN; }, { code = 330; description = "Failed to resolve linkage dependency IRLDocumentScanner x86_64 -> @rpath/TOCropViewController.framework/TOCropViewController: Unknown arch x86_64"; info = { }; level = WARN; }, { code = 306; description = "Failed to resolve rpath for TOCropViewController: Could not resolve @executable_path for @executable_path/Frameworks from TOCropViewController"; info = { }; level = WARN; }, { code = 306; description = "Failed to resolve rpath for TOCropViewController: Could not resolve @executable_path for @executable_path/Frameworks from TOCropViewController"; info = { }; level = WARN; }, { code = 0; description = "Failed to verify bitcode in IRLDocumentScanner.framework/IRLDocumentScanner:\nerror: Cannot extract bundle from /var/folders/ns/7dl_s86d7vl24x7tzmq9q3tm0000gn/T/IDEDistributionOptionThinning.wYA/Payload/InCAB.app/Frameworks/IRLDocumentScanner.framework/IRLDocumentScanner (i386)\n\n"; info = { }; level = ERROR; type = "malformed-payload"; }, { code = 0; description = "Failed to verify bitcode in TOCropViewController.framework/TOCropViewController:\nerror: Cannot extract bundle from /var/folders/ns/7dl_s86d7vl24x7tzmq9q3tm0000gn/T/IDEDistributionOptionThinning.wYA/Payload/InCAB.app/Frameworks/TOCropViewController.framework/TOCropViewController (i386)\n\n"; info = { }; level = ERROR; type = "malformed-payload"; } );

Regards, Toni

EDIT: I was able to make it work by taking care that Run Script task is done after Copy Files in Build Phases

ATY77 commented 5 years ago

Hello Chris,

We have similar issue when building our App with the Adobe PhoneGap Build service. But unfortunately the Abobe PhoneGap Build service does not allow us to manipulate the buildprocess so we cannot remove the x86_64 and i386 architecture. Is there another way to solve this issue? Maybe u can fix this in your plugin?

ERROR ITMS-90087: "Unsupported Architectures. The executable for BrancheView App.app/Frameworks/IRLDocumentScanner.framework contains unsupported architectures '[x86_64, i386]'." ERROR ITMS-90087: "Unsupported Architectures. The executable for BrancheView App.app/Frameworks/TOCropViewController.framework contains unsupported architectures '[x86_64, i386]'." ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'BrancheView App.app/Frameworks/IRLDocumentScanner.framework/IRLDocumentScanner' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version." ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'BrancheView App.app/Frameworks/TOCropViewController.framework/TOCropViewController' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version." ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's lin

reezooh commented 4 years ago

Hi there, Chris!

Still having this problem when building my App with the Adobe PhoneGap Build service.

Did you find a solution for this?

Thanks in advance.

ChrisTomAlx commented 4 years ago

@reezooh You could try the 3.x.x version of this plugin. It uses another library. Let me know if you still have problems. Also don't forget to follow the readme of the 3.x.x plugin which you can find here. There are small differences.

Cheers, Chris Neutrinos

reezooh commented 4 years ago

Hi, Chris.

I tried using 3.x.x version.

Now I cannot even compile.

Getting this log:

CompileSwift normal arm64 /project/TransPortes/Plugins/cordova-plugin-document-scanner/ScanPlugin/Scan.swift cd /project /Applications/Xcode101.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /project/TransPortes/Plugins/cordova-plugin-document-scanner/ScanPlugin/Scan.swift -emit-module-path /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan~partial.swiftmodule -emit-module-doc-path /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan~partial.swiftdoc -serialize-diagnostics-path /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan.dia -emit-dependencies-path /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan.d -emit-reference-dependencies-path /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan.swiftdeps -target arm64-apple-ios10 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode101.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -I /private/project/build/device -F /private/project/build/device -g -module-cache-path /Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 3 -O -serialize-debugging-options -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/swift-overrides.hmap -Xcc -iquote -Xcc /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/TransPortes-generated-files.hmap -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/TransPortes-own-target-headers.hmap -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/TransPortes-all-target-headers.hmap -Xcc -iquote -Xcc /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/TransPortes-project-headers.hmap -Xcc -I/private/project/build/device/include -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/InstallationBuildProductsLocation/Applications/usr/local/lib/include -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/UninstalledProducts/include -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/include -Xcc -I/private/project/build/device -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/DerivedSources/arm64 -Xcc -I/Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/DerivedSources -Xcc -working-directory/project -import-objc-header /project/TransPortes/Bridging-Header.h -pch-output-dir /private/project/build/sharedpch -pch-disable-validation -parse-as-library -module-name TransPortes -o /Library/Developer/Xcode/DerivedData/TransPortes-dngtvmfvmgpjvwcwmzhwkynonnck/Build/Intermediates.noindex/ArchiveIntermediates/TransPortes/IntermediateBuildFilesPath/TransPortes.build/Release-iphoneos/TransPortes.build/Objects-normal/arm64/Scan.o /project/TransPortes/Plugins/cordova-plugin-document-scanner/ScanPlugin/Scan.swift:2:8: error: no such module 'WeScan' import WeScan ^

ARCHIVE FAILED

The following build commands failed: CompileSwift normal armv7 /project/TransPortes/Plugins/cordova-plugin-document-scanner/ScanPlugin/Scan.swift CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler CompileSwift normal arm64 /project/TransPortes/Plugins/cordova-plugin-document-scanner/ScanPlugin/Scan.swift CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (4 failures) Error: xcodebuild: Command failed with exit code 65 at ChildProcess.whenDone (/private/project/cordova/node_modules/cordova-common/src/superspawn.js:135:23) at ChildProcess.emit (events.js:182:13) at maybeClose (internal/child_process.js:962:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

ChrisTomAlx commented 4 years ago

I think you missed the pod install step (Although I am not sure how phonegap handles this, a lot of plugins use pods though, so it must be possible somehow). Please follow the steps in the README I linked to earlier exactly. The steps to integrate it are different compared to 4.x.x.

Cheers, Chris Neutrinos

dylanvdmerwe commented 4 years ago

Seems to no longer be a problem. Tested with v4.2.1.

ChrisTomAlx commented 4 years ago

Hey all,

Sorry I was not able to help a lot with this issue up until now. Anyone still not able to publish app to app store due to the unsupported architectures issue caused by this plugin or any other plugin for that matter can follow these steps below :-

  1. Firstly add the xcode package to your project :

     npm i xcode
  2. Then add this file to your root folder where config.xml exists.

  3. Then add the following to your config.xml file :

    <hook src="addPhaseRunScript.js" type="after_platform_add" />
  4. You can remove and re-add the ios platform (This causes the hook script to run after the ios platform has been added) using :

    cordova platform rm ios
    cordova platform add ios
  5. Done! You shouldn't be getting this error anymore!!

Cheers, Chris Neutrinos

Marko1985 commented 4 years ago

Hey all,

Sorry I was not able to help a lot with this issue up until now. Anyone still not able to publish app to app store due to the unsupported architectures issue caused by this plugin or any other plugin for that matter can follow these steps below :-

  1. Firstly add the xcode package to your project :
    npm i xcode
  2. Then add this file to your root folder where config.xml exists.
  3. Then add the following to your config.xml file :
    <hook src="addPhaseRunScript.js" type="after_platform_add" />
  4. You can remove and re-add the ios platform (This causes the hook script to run after the ios platform has been added) using :
    cordova platform rm ios
    cordova platform add ios
  5. Done! You shouldn't be getting this error anymore!!

Cheers, Chris Neutrinos

Hi, I have problems with your solution, my console launchs:

Error: Cannot read property 'project' of undefined

I tried reinstall xcode, put relative paths in require but nothing, some solution?

Marko1985 commented 4 years ago

Could you help me? please, I need solve this problem ASAP.

Regards.

windht commented 4 years ago

@Marko1985 If you don't want to run the script with cordova, you can add the script to build phase in xcode directly.

See screenshot. image

BTW, I am using the script here and it works great. https://stackoverflow.com/a/41416964