Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not generate IPA when adding 'MMKVWatchExtension' (ipatool failed with an exception) #749

Closed
4 tasks done
canhth opened this issue Aug 30, 2021 · 13 comments
Closed
4 tasks done

Comments

@canhth
Copy link

canhth commented Aug 30, 2021

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?

Screen Shot 2021-08-30 at 20 15 47

- XCode Distribution Logs: [xcdistributionlogs.zip](https://github.com/Tencent/MMKV/files/7077412/xcdistributionlogs.zip)

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:
  • BUILD_LIBRARY_FOR_DISTRIBUTION must be set to YES
  • SKIP_INSTALL must be set to NO
  • GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
  • CLANG_ENABLE_CODE_COVERAGE = NO to turn off code coverage tools from the binary
@canhth
Copy link
Author

canhth commented Aug 31, 2021

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)

@lingol
Copy link
Collaborator

lingol commented Aug 31, 2021

Got it.

@canhth
Copy link
Author

canhth commented Aug 31, 2021

Hi @lingol ,

I've create a temporary fix in this PR: #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.

@lingol
Copy link
Collaborator

lingol commented Sep 8, 2021

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.
    image

@canhth
Copy link
Author

canhth commented Sep 8, 2021

  • 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.

Screen Shot 2021-09-09 at 02 04 28

Screen Shot 2021-09-09 at 02 04 46

@lingol
Copy link
Collaborator

lingol commented Sep 9, 2021

What's your exact steps to reproduce this error? Can you describe it step by step?

@canhth
Copy link
Author

canhth commented Sep 9, 2021

Here are the steps:

  1. Clone the MMKV repo.
  2. Open MMKVDemo project and select MMKVDemo target for iOS.
  3. Archive build.
  4. Archive completed --> Select Distribute App.
  5. Select Development in the popup Method of app Distribution. --> click Next
  6. The Rebuild from Bitcode option is enabled by default. --> click Next
  7. Automatically manage signing as a default --> click Next
  8. The error displayed.

I'm using Xcode 12.5. And you can check the full error logs here:
Logs.zip

@lingol
Copy link
Collaborator

lingol commented Sep 9, 2021

Okay, now I can reproduce your error. May I ask why did you choose Development instead of App Store Connect in step 5?

@lingol
Copy link
Collaborator

lingol commented Sep 9, 2021

I mean if you want to upload to App Store, why don't you just choose it? It will have no problems about bitcode.

@canhth
Copy link
Author

canhth commented Sep 9, 2021

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.

@lingol
Copy link
Collaborator

lingol commented Sep 10, 2021

Why would they reject the build? You should try.

@canhth
Copy link
Author

canhth commented Sep 10, 2021

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.

@lingol
Copy link
Collaborator

lingol commented Jun 7, 2022

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.

@lingol lingol closed this as completed Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants