I've been using the following GitHub action to publish my .NET MAUI app to TestFlight and it's been working fine. Today, I got this error:
The type 'UIKit.UISceneSessionActivationRequest' (used as a parameter in UIKit.UIApplication.ActivateSceneSession) is not available in iOS 16.2 (it was introduced in iOS 17.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode).
I'm using the latest version of MacOS -- see below -- in my GitHub action.
Also, as per code changes in my app, I'm not really introducing anything new. Some bug fixes and a couple of new pages that just make API calls and display data in CollectionView
's. So, I'm not really doing anything new or fancy with this version. This version is targeting .NET 8 but I was even able to publish a version of my app targeting .NET 8 RC2 using this GitHub action.
Here's my GitHub action YAML:
name: Build & Publish My .NET MAUI iOS App
on:
pull_request:
branches: [ "master" ]
jobs:
build-pack-n-ship:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install MAUI workload
run: dotnet workload install maui
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-filepath: 'MyAppleDistributionCert.p12'
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Download Apple Provisioning Profiles
uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: 'myapp.mydomain.com'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: Restore dependencies
run: dotnet restore
- name: Build and Publish
run: dotnet publish -c Release -f:net8.0-ios /p:ArchiveOnBuild=true /p:EnableAssemblyILStripping=false
- name: List generated files
run: ls -l
- name: Upload Build Artifact
uses: actions/upload-artifact@v3.0.0
with:
path: '**/*.ipa'
- name: 'Upload app to TestFlight'
uses: apple-actions/upload-testflight-build@v1
with:
app-path: './MyApp/bin/Release/net8.0-ios/ios-arm64/publish/MyApp.ipa'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
Any suggestions?
Here's how I fixed it:
First, I changed the masOS version to runs-on: macos-13
.
Then I added a step to pick the latest version of Xcode by adding the following:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
BTW, I didn't use xcode-version: latest-stable
which allows me to use the beta version of Xcode 15.
Here's the updated version of my YAML:
name: Build & Publish My .NET MAUI iOS App
on:
pull_request:
branches: [ "master" ]
jobs:
build-pack-n-ship:
runs-on: macos-13
steps:
- uses: maxim-Lobanov/setup-xcode@v1
with:
xcode-version: latest
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install MAUI workload
run: dotnet workload install maui
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-filepath: 'MyAppleDistributionCert.p12'
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Download Apple Provisioning Profiles
uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: 'myapp.mydomain.com'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: Restore dependencies
run: dotnet restore
- name: Build and Publish
run: dotnet publish -c Release -f:net8.0-ios /p:ArchiveOnBuild=true /p:EnableAssemblyILStripping=false
- name: List generated files
run: ls -l
- name: Upload Build Artifact
uses: actions/upload-artifact@v3.0.0
with:
path: '**/*.ipa'
- name: 'Upload app to TestFlight'
uses: apple-actions/upload-testflight-build@v1
with:
app-path: './MyApp/bin/Release/net8.0-ios/ios-arm64/publish/MyApp.ipa'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
IMPORTANT: Changing only the macos-version
to 13 did not work because there seems to be multiple versions of Xcode in the image -- see: https://github.com/actions/runner-images/blob/macos-13/20231025.2/images/macos/macos-13-Readme.md
Thanks to these devs here for guiding me through this process: https://github.com/dotnet/maui/issues/18632#issuecomment-1817943549