Bitcode is deprecated when publishing app to appstore MAUI in 7.0.200-preview.22628.1
KSemenenko opened this issue · 45 comments
Description
I installed the latest version of VS code for Mac (7.0.200-preview.22628.1 with MAUI workload) and found out that this issue is still there.
#10989
Steps to Reproduce
Use a framework containing bitcode
Link to public reproduction project repository
no
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
IOS
Did you find any workaround?
<PropertyGroup>
<!-- Properties used to strip bitcode from frameworks when using Visual Studio for Mac -->
<_StripBitcodeFromFrameworksMasterAfterTargets Condition="'$(OS)'=='Unix'">_ExpandNativeReferences</_StripBitcodeFromFrameworksMasterAfterTargets>
<_StripBitcodeFromFrameworksMasterDependsOnTargets Condition="'$(OS)'=='Unix'">_StripBitcodeFromFrameworksOnMac</_StripBitcodeFromFrameworksMasterDependsOnTargets>
<!-- Properties used to strip bitcode from frameworks when using Visual Studio for Windows -->
<_StripBitcodeFromFrameworksMasterAfterTargets Condition="'$(OS)'!='Unix'">_ComputeFrameworkFilesToPublish</_StripBitcodeFromFrameworksMasterAfterTargets>
<_StripBitcodeFromFrameworksMasterDependsOnTargets Condition="'$(OS)'!='Unix'">_StripBitcodeFromFrameworksOnWindows</_StripBitcodeFromFrameworksMasterDependsOnTargets>
</PropertyGroup>
<Target Name="_StripBitcodeFromFrameworksMasterTarget"
Condition="'$(_StripBitcodeFromFrameworksMasterDependsOnTargets)'!='' AND @(_FrameworkNativeReference->Count()) != 0"
AfterTargets="$(_StripBitcodeFromFrameworksMasterAfterTargets)"
DependsOnTargets="$(_StripBitcodeFromFrameworksMasterDependsOnTargets)" />
<Target Name="_StripBitcodeFromFrameworksOnMac"
Condition="('$(OutputType)'!='Library' OR '$(IsAppExtension)'=='True') AND '$(_SdkIsSimulator)'=='False'">
<!-- Find the bitcode_strip command -->
<Exec Command="xcrun -find bitcode_strip" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="_BitcodeStripCommand" />
</Exec>
<!-- Strip the bitcode from frameworks -->
<Exec Command="$(_BitcodeStripCommand) %(_FrameworkNativeReference.Identity) -r -o %(_FrameworkNativeReference.Identity)" />
</Target>
<Target Name="_StripBitcodeFromFrameworksOnWindows"
Condition="('$(OutputType)'!='Library' OR '$(IsAppExtension)'=='True') AND '$(_SdkIsSimulator)'=='False' AND '$(IsMacEnabled)'=='true'">
<!-- Strip the bitcode from frameworks -->
<Exec SessionId="$(BuildSessionId)"
Command=""%24(xcrun -find bitcode_strip)" %(_FrameworkNativeReference.Identity) -r -o %(_FrameworkNativeReference.Identity)" />
<CopyFileFromBuildServer
SessionId="$(BuildSessionId)"
File="%(_FrameworkNativeReference.Identity)"
TargetFile="%(_FrameworkNativeReference.Identity)" />
</Target>
This code helped me. the solution works.
Maybe it should be added by default?
Relevant log output
No response
@SotoiGhost thoughts?
Hi @KSemenenko! 👋🏼 Thank you for your time in reporting this issue.
I think this is a question for the iOS team. The workaround seems harmless, but not sure if this could cause any harm later as this is directly modifying the framework saved on the disk.
@dalexsoto, @rolfbjarne, thoughts on this?
P.S: Regardless of whether this is added, it is best to report the affected framework to its owner so they can fix this from the root.
I'm currently doing native binding for agora, they have xcframework.
This is their official sdk, and it seems to work for swift or objective c.
I have this issue when I send the binary to TestFlight.
Also, the experience with bindings in general is not very smooth. It turned out that sln with the bindings library can't be next to maui project. It should be a separate project.
I'm still working on it, but if you need any feedback, I'll be happy to help =)
@KSemenenko you can verify if a framework has bitcode or has the bitcode marker flag enabled by running the following command:
# Replace the path
otool -l path/to/your/Foo.xcframework/ios-arm64/Foo.framework/Foo | grep __LLVM -1
The command should not throw anything if there's no bitcode, otherwise will throw you something like this:
cmdsize 152
segname __LLVM
vmaddr 0x000000000006c000
--
sectname __bundle
segname __LLVM
addr 0x000000000006c000
Hope this helps you!
Thanks for your advice, I think now that my sdk is swift.
https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-swift/walkthrough
Will try this one
one more questions, https://swiftpackageindex.com/AgoraIO/AgoraRtcEngine_iOS
so this is swift, but if it xcframework I have to anyway create one more swift librarty or I can just use sdk, because thay have h files
Also, the experience with bindings in general is not very smooth. It turned out that sln with the bindings library can't be next to maui project. It should be a separate project.
Yes, we know it's not very smooth, we have known issues we're working on in this area.
I think this is a question for the iOS team. The workaround seems harmless, but not sure if this could cause any harm later as this is directly modifying the framework saved on the disk.
Yes, the workaround seems harmless, but I'm hesitant to add code on our side for this, because:
- The app developer can work around it themselves.
- The real fix is for the vendor to fix their SDK to not contain bitcode (since Apple completely deprecated bitcode, at the very least it's useless to ship it).
- It may seem harmless, but there's always a risk.
@rolfbjarne thanks for answers!
Well, in fact, for me it is the documentation that is the most difficult. I do not understand the clear steps to be taken. I'm C# developer and have no idea aboout swift and xcode.
So far I have realized that I have to make another library which will be a wrapper for the sdk (and this makes a lot of sense)
But on the other side of the SDK is the same exact library .framework
And according to the documentation, I then have to add to the iOS project a link to the original sdk and a link to my new library-binding-wrapper. But then why do I need an wrapper?
But I'm optimistic and determined to do it =)
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.