简体   繁体   中英

Build iOS app with Notification Extension with fastlane

I recently added a notification extension to my app which was built well with fastlane. After adding the notification extension the building is always failing because of some code signing issue.

The lane for building my app and uploading it to TestFlight is:

    lane :beta do
         increment_build_number(
            build_number: latest_testflight_build_number + 1,
            xcodeproj: "ios.xcodeproj"
         )
         match(app_identifier: ["my.app.bundleid", "my.app.bundleid.extension" type: "appstore") 
         gym(scheme: "prod")
         ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t DAV"
         pilot(
           skip_submission: true,
           skip_waiting_for_build_processing: true
         ) 
    end

I have created the App IDs and provisioning profiles for both bundle ids and I have enabled the push notification for both of them.

Even though I am getting the following error after running fastlane beta :

[19:13:20]: $ /usr/bin/xcrun /Library/Ruby/Gems/2.3.0/gems/fastlane-2.96.1/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/vq/j6j2lh1s3cz7cbpw7shc9149fy4t4_/T/gym_config20180601-5305-a3y0ow.plist' -archivePath /Users/viktor.plezer/Library/Developer/Xcode/Archives/2018-06-01/prod\ 2018-06-01\ 19.07.57.xcarchive -exportPath '/var/folders/vq/j6j2lh1s3cz7cbpw7shc9149fy4t4_/T/gym_output20180601-5305-ghy31c' 
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/vq/j6j2lh1s3cz7cbpw7shc9149fy4t4_/T/gym_config20180601-5305-a3y0ow.plist -archivePath '/Users/viktor.plezer/Library/Developer/Xcode/Archives/2018-06-01/prod 2018-06-01 19.07.57.xcarchive' -exportPath /var/folders/vq/j6j2lh1s3cz7cbpw7shc9149fy4t4_/T/gym_output20180601-5305-ghy31c
2018-06-01 19:13:21.181 xcodebuild[7741:1606819] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/vq/j6j2lh1s3cz7cbpw7shc9149fy4t4_/T/prod_2018-06-01_19-13-21.180.xcdistributionlogs'.
2018-06-01 19:13:25.613 xcodebuild[7741:1606819] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff969a6c950>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
"Error Domain=IDEProvisioningErrorDomain Code=9 \"\"prod.app\" requires a provisioning profile with the Push Notifications feature.\" UserInfo={NSLocalizedDescription=\"prod.app\" requires a provisioning profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}"
)}
error: exportArchive: "prod.app" requires a provisioning profile with the Push Notifications feature.

Error Domain=IDEProvisioningErrorDomain Code=9 ""prod.app" requires a provisioning profile with the Push Notifications feature." UserInfo={NSLocalizedDescription="prod.app" requires a provisioning profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}

** EXPORT FAILED **
[19:13:26]: Exit status: 70
[19:13:26]: No provisioning profile provided
[19:13:26]: Make sure to pass a valid provisioning for each required target
[19:13:26]: Check out the docs on how to fix this: https://docs.fastlane.tools/actions/gym/#export-options

I have added both bundle ids into my Matchfile, fastlane can download the certs correctly.

provisioningProfiles dict looks like:

INFO [2018-06-01 20:08:45.03]: ▸ <?xml version="1.0" encoding="UTF-8"?>
INFO [2018-06-01 20:08:45.03]: ▸ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
INFO [2018-06-01 20:08:45.03]: ▸ <plist version="1.0">
INFO [2018-06-01 20:08:45.03]: ▸ <dict>
INFO [2018-06-01 20:08:45.03]: ▸    <key>method</key>
INFO [2018-06-01 20:08:45.03]: ▸    <string>app-store</string>
INFO [2018-06-01 20:08:45.03]: ▸    <key>provisioningProfiles</key>
INFO [2018-06-01 20:08:45.03]: ▸    <dict>
INFO [2018-06-01 20:08:45.03]: ▸        <key>my.app.bundleid.extension</key>
INFO [2018-06-01 20:08:45.03]: ▸        <string>match AppStore my.app.bundleid.extension</string>
INFO [2018-06-01 20:08:45.03]: ▸        <key>my.app.bundleid</key>
INFO [2018-06-01 20:08:45.03]: ▸        <string>match AppStore my.app.bundleid</string>
INFO [2018-06-01 20:08:45.03]: ▸    </dict>
INFO [2018-06-01 20:08:45.03]: ▸    <key>signingStyle</key>
INFO [2018-06-01 20:08:45.03]: ▸    <string>manual</string>
INFO [2018-06-01 20:08:45.03]: ▸ </dict>
INFO [2018-06-01 20:08:45.03]: ▸ </plist>
INFO [2018-06-01 20:08:45.03]: ▸ -----------------------------------------

Why does fastlane start to search for provisioning profile for prod.app and not my.app.bundleid?

This was the exact error I was receiving and the issue in my case was an invalid value for CFBundleIdentifier in the extension's plist file. Once I changed it to the below, the build succeeded:

<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM