MMKV
MMKV copied to clipboard
Can not generate IPA when adding 'MMKVWatchExtension' (ipatool failed with an exception)
The language of MMKV
- Objective-C, Swift
The version of MMKV
- 1.2.10
The platform of MMKV
- iOS & WatchOS
The installation of MMKV
- Cocoapods 1.10.0
What's the issue?
- I'm getting this error when trying to create IPA build for my application (iOS and WatchOS targets):
ipatool failed with an exception: #<CmdSpec::NonZeroExitException: ....
(Full log in Xcode Distribution Logs) - Everything working normally with MMKV for iOS, the error just appears when adding
MMKVWatchExtension
to the Watch Extension target.
What's the log of MMKV when that happened?

Note: I tried to uncheck Rebuild from Bitcode
and it can generate the IPA file.
But afraid it will be rejected by Apple, because Bitcode is the default for WatchOS.
This is my pod file:
target 'TestingWatch-Tarrget' do
use_frameworks!
pod 'MMKV', '1.2.10'
end
target 'Watch-Demo' do
use_frameworks!
end
target 'Watch-Demo Extension' do
use_frameworks!
pod 'MMKVWatchExtension', '1.2.10'
end
- Here are what I tried but still getting the error:
- [x] BUILD_LIBRARY_FOR_DISTRIBUTION must be set to YES
- [x] SKIP_INSTALL must be set to NO
- [x] GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
- [x] CLANG_ENABLE_CODE_COVERAGE = NO to turn off code coverage tools from the binary
I guess the problem is similar with this: https://github.com/apple/swift-nio-ssl/pull/277/files
We also have .S
file in our MMKVCore
. (openssl_aesv8-armx.S, openssl_aes-armv4.S)
Got it.
Hi @lingol ,
I've create a temporary fix in this PR: https://github.com/Tencent/MMKV/pull/752
And confirm that it fixes the Rebuild from Bitcode
issue.
But my fix is to disable the MMKV_DISABLE_CRYPT
for WatchOS which I'm not quite sure it's will causing any bug.
So far, my project does not use de/encryption, so it should be okay for my Forked.
Could you please help me to take a look? Thanks a lot.
I have tried to archive and export our MMKVDemo App, which contains a Watch App target, to an IPA. And I have also successfully uploaded it to App Store Connect without facing such errors.
There are two things different from your situation.
- The MMKVDemo App enables bitcode by default.
- I use Xcode 12.5.1 which doesn't have the so-called Rebuild from bitcode but with Include bitcode for iOS content instead. This might be as well just a result of enabling bitcode by default.
- I don't think there is a difference between using the default Bitcode enable when creating a new project and the old project.
Bitcode is optional as Apple said, and it should be the same in the Distribution option. - I'm using Xcode 12.5 and MMKVDemo App in this repo. But the option
Rebuild from Bitcode
is still available, maybe I will try version 12.5.1 like yours.
What's your exact steps to reproduce this error? Can you describe it step by step?
Here are the steps:
- Clone the MMKV repo.
- Open MMKVDemo project and select MMKVDemo target for iOS.
- Archive build.
- Archive completed --> Select Distribute App.
- Select
Development
in the popup Method of app Distribution. --> click Next - The Rebuild from Bitcode option is enabled by default. --> click Next
- Automatically manage signing as a default --> click Next
- The error displayed.
I'm using Xcode 12.5. And you can check the full error logs here: Logs.zip
Okay, now I can reproduce your error. May I ask why did you choose Development
instead of App Store Connect
in step 5?
I mean if you want to upload to App Store, why don't you just choose it? It will have no problems about bitcode.
Because my CI/CD supports: Develop
for internal testing, and Release
for submitting the build.
And I believed all the companies nowadays doing that as well.
- For develop: we need to generate the IPA with 'Ad-Hoc', which is failing right now. (Ad-hoc and Development are the same, it has the option "Rebuild from Bitcode".)
- For Release: Yes, because the rebuild from Bitcode is not available with release mode, so it should be okay though. But I'm not sure if the build will be rejected when Apple processing the build in their side.
Why would they reject the build? You should try.
It should be no issue when Upload to AppStore. BUT this is blocking us to share the Development build with Testers. (fastlane ad-hoc will failed) We need to generate Ad-hoc build in almost every Pull Request. To let QA team verify the ticket.
TestFlight only is not a good option in my case.
Did you solve the problem eventually? I've just learned that starting from Xcode 14, bitcode is no longer supported. So I'm not going to do anything about it in this library.