sparkfabrik / ios-build-action

Build iOS project (.xcodeproj, .xcworkspace), export .ipa, optional upload to BrowserStack App Live.
MIT License
129 stars 24 forks source link

Build fails with new version of Xcode (XCode 14) #17

Closed bpolaszek closed 1 year ago

bpolaszek commented 1 year ago

Hello there,

My builds (CapacitorJS project) now fail (they used to work a few weeks ago with the same Github pipeline) with the following error:

[13:56:06]: Generated plist file with the following values:
[13:56:06]: ▸ -----------------------------------------
[13:56:06]: ▸ {
[13:56:06]: ▸   "provisioningProfiles": {
[13:56:06]: ▸     "***********": "match AppStore ***********"
[13:56:06]: ▸   },
[13:56:06]: ▸   "method": "app-store",
[13:56:06]: ▸   "uploadBitcode": true,
[13:56:06]: ▸   "signingStyle": "manual",
[13:56:06]: ▸   "teamID": "***"
[13:56:06]: ▸ }
[13:56:06]: ▸ -----------------------------------------
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/gym_config20221018-3547-kilva.plist -archivePath '/Users/runner/Library/Developer/Xcode/Archives/2022-10-18/output 2022-10-18 13.53.42.xcarchive' -exportPath /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/gym_output20221018-3547-ijrhmz
2022-10-18 13:56:08.429 xcodebuild[10073:26398] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/App_2022-10-18_13-56-08.427.xcdistributionlogs".
error: exportArchive: exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced

Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced}

After some research here and there it looks like the MacOS platform is now using XCode 14, which deprecates that "bitcode" stuff that I know absolutely nothing about.

It seems that uploadBitcode should actually be set to false but it looks like I don't have access to that setting.

As a temporary fix, I added this in my Github workflow file:

- name: Enforce XCode version
  uses: maxim-lobanov/setup-xcode@v1
  with:
    xcode-version: '13.4.1'

So that the previous version of Xcode can be used, and it succeeds.

I don't know if there's something you can do about that bitcode thing, but if you have a clue of what this is about and know how to solve it...

Thanks! Ben

edodusi commented 1 year ago

@bpolaszek maybe I could enforce the xcode-version on the action, what do you think?

bpolaszek commented 1 year ago

I don't think it's a long-term solution, but it's up to you!

edodusi commented 1 year ago

Ok, will need some more investigation here

edodusi commented 1 year ago

Hi @bpolaszek, we released version 2.1.0 of this action with some fixes, can you please try again and report if you still get this error?

bpolaszek commented 1 year ago

Hi @edodusi,

We just gave it a try but it didn't work either. Our pipeline only works when doing this:

- name: Enforce XCode version
   uses: maxim-lobanov/setup-xcode@v1
     with:
       xcode-version: '13.4.1'

Without enforcing XCode version, GA yells something like this:

+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/gym_config20230208-6840-jzab1x.plist -archivePath '/Users/runner/Library/Developer/Xcode/Archives/2023-02-08/output 2023-02-08 15.04.17.xcarchive' -exportPath /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/gym_output20230208-6840-jye6a2
2023-02-08 15:07:00.999 xcodebuild[13207:35328] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/App_2023-02-08_15-07-00.994.xcdistributionlogs".
error: exportArchive: exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced

Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key "uploadBitcode": cannot upload bitcode because bitcode is imbalanced}

** EXPORT FAILED **
[15:07:03]: Exit status: 70

+---------------+------------------------------+
|              Build environment               |
+---------------+------------------------------+
| xcode_path    | /Applications/Xcode_14.2.app |
| gym_version   | 2.211.0                      |
| export_method | app-store                    |
| sdk           | iPhoneOS16.2.sdk             |
+---------------+------------------------------+
edodusi commented 1 year ago

Ok @bpolaszek I think this issue is related to your build settings, because you're trying to upload bitcode and Xcode 14 no longer supports this:

Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14.

https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations

So maybe disabling it will fix this, let me know.

edodusi commented 1 year ago

@bpolaszek please try the latest 2.2.0 release that should fix this issue

misaert commented 1 year ago

Hi @edodusi,

I (@bpolaszek's teammate) confirm the latest 2.2.0 release has resolved this issue :+1:

edodusi commented 1 year ago

Thanks @misaert !