Open ROBYER1 opened 3 years ago
I have found that OpenCV still works in our app when I remove libopencvforunity.a and OpenCVForUnityAppController.mm from the Embed frameworks build phase - howcome they are in there if they don't do anything in the build but create errors when we package the app to upload?
Thank you very much for reporting. I will look into this and get back to you.
Also, I'm not sure if Unity currently supports Xcode 12.4; the latest Xcode version available for selection in CloudBuild is 12.2.
All of our local built apps not using OpenCV on Xcode 12.4 build run and upload fine but I know there is usually a lag with cloud build Xcode versions.
Hopefully this is a useful heads up if anything needs to be fixed before they add Xcode 12.4 to cloud build but it's definitely an issue for locally archived apps
I tried the project you shared the link for in my environment and got the same error. OpenCV for Unity 2.4.3 UnityEditor: 2020.3.0f1 Build Target: IOS Xcode: 12.4 MacOS: 10.15.4
However, when I imported your project's files into the new empty project, I was able to successfully archive and validate them.
That does help to isolate this issue a little, I did try before copying the package manifest into another project with opencv but found the issue didn't happen there. I am more confident this has something to do with either the project library folder or project settings
I just tried clearing the library, still got the error - I will try to look into this further to find out what the root cause is
As Xcode 12.5 is out now which apparently fixes this, I will be testing out if the issue is gone, hopefully I will be able to do this by or just after friday this week coming and will report back here to let you know if it is still an issue!
This is still an issue with Xcode 12.5 which I have tried archiving/uploading with and we still have to use the workaround: remove libopencvforunity.a and OpenCVForUnityAppController.mm from the Embed frameworks build phase
Perhaps there is some kind of problem with the project folder. Could you try to delete the "Library" folder from the project folder?
Perhaps there is some kind of problem with the project folder. Could you try to delete the "Library" folder from the project folder?
Have done this many times already, we work with source control on the project now too and the issue happens on all our machines even with a fresh pull of the code and no existing library folder (so a new one is generated).
Is there any way to automate removing these embedded frameworks when we build and export out app from Unity to Xcode?
I have put together a small repro project for this as it was an issue affecting 2 apps we are working on and I had to remove OpenCV from both of them just to get them to upload to Testflight.
When building and running to the ipad or iphone, works fine but when we go to archive and validate or upload, we are met with: unexpected Mach-O header code: 0x72613c21
In the logs I get in the IDEDistribution.standard.log which I am prompted to open when I get the error (I just ctrl+F searched 'error' there):
2021-04-06 23:09:12 +0000 [OPTIONAL] Didn't find info dictionary for <DVTFilePath:0x7ff29bd4a540:'/Users/sparklabmac/Library/Developer/Xcode/Archives/2021-04-07/Unity-iPhone 07-04-2021, 00.08.xcarchive/Products/Applications/OpenCVBug.app/Frameworks/libopencvforunity.a'>: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't load Info dictionary for <DVTFilePath:0x7ff29bd4a540:'/Users/sparklabmac/Library/Developer/Xcode/Archives/2021-04-07/Unity-iPhone 07-04-2021, 00.08.xcarchive/Products/Applications/OpenCVBug.app/Frameworks/libopencvforunity.a'>" UserInfo={NSLocalizedDescription=Couldn't load Info dictionary for <DVTFilePath:0x7ff29bd4a540:'/Users/sparklabmac/Library/Developer/Xcode/Archives/2021-04-07/Unity-iPhone 07-04-2021, 00.08.xcarchive/Products/Applications/OpenCVBug.app/Frameworks/libopencvforunity.a'>}
and also
issueDate='2021-02-15 14:55:30 +0000''> for <DVTFilePath:0x7ff29bd4a540:'/Users/sparklabmac/Library/Developer/Xcode/Archives/2021-04-07/Unity-iPhone 07-04-2021, 00.08.xcarchive/Products/Applications/OpenCVBug.app/Frameworks/libopencvforunity.a'>: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family for "libopencvforunity.a"." UserInfo={NSLocalizedDescription=Couldn't find platform family for "libopencvforunity.a"., NSLocalizedRecoverySuggestion=Couldn't find CFBundleSupportedPlatforms in the Info.plist, LC_VERSION_MIN, or LC_BUILD_VERSION in the Mach-O for path "/Users/sparklabmac/Library/Developer/Xcode/Archives/2021-04-07/Unity-iPhone 07-04-2021, 00.08.xcarchive/Products/Applications/OpenCVBug.app/Frameworks/libopencvforunity.a".}
OpenCV 2.4.3 Editor: 2020.3.0f1 Build Target: IOS Xcode: 12.4 Test Ipad - latest gen and IOS 14 MacOS: Big Sur 11.2.3
Initially, I thought it was all the plugins in the project so I removed them one by one, and the same for the packages. Nothing seemed to work to fix the archive errors. I stripped everything out of the project and what you have in the link below of what I got to.
I found this thread suggesting it could be to do with static libraries being linked: https://github.com/firebase/firebase-ios-sdk/issues/6472 ..and traced through to this Apple troubleshooting thread suggesting to: https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING
I tried that and removed libopencvforunity.a and the opencv stuff in the build still worked but then there was an error from xcode on upload about OpenCVForUnityAppController.mm missing some references so I ripped that out of embed frameworks phase then could finally upload the build but albeit probably with broken opencv functionality.
With this sample project you can build it from unity for IOS as is, open in XCode then archive and try to validate it you will see the same error, ignore the fact the scene is basically empty as I stripped it of everything for my tests.
Is there a way this can be fixed in an upcoming release? Or at least some guidance for me as to what is going wrong on the Xcode end as I usually just build and run and then when ready to submit go archive it just these projects I have with OpenCV have errors when we archive to upload