Unable to assign provisioning profile for app extension

#1

I’m building an iOS and Android app using Ionic 3. It builds locally via xcode and installs on my device but in Bitrise I get a build error.

The app uses this plugin: cc.fovea.cordova.openwith

Which uses the Share Extension and therefore requires it’s own bundle ID and provisioning profile, which you can specify in config.xml and package.json using “SHAREEXT_PROVISIONING_PROFILE”.

I created a unique app ID and provisioning profile in developer.apple and uploaded it to Bitrise (com.myapp.myapp.shareextension).

The result is:

Archive failed.

Error: Provisioning profile “myapp ShareExt” has app ID “com.myapp.myapp.shareextension”, which does not match the bundle ID “com.myapp.myapp”. (in target ‘ShareExt’)

I tried setting the config/package to the same provisioning profile as the main app (com.myapp.myapp)

The result was:

Archive Succeeded. Export Failed.

Error: Domain=IDEProvisioningErrorDomain Code=9 ““ShareExt.appex” requires a provisioning profile.” UserInfo={NSLocalizedDescription=“ShareExt.appex” requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the “provisioningProfiles” dictionary in your Export Options property list.}

I also tried a separate profile ID based on main app ID. Same error.

I’ve tested loads of settings in Bitrise, such as:

  • Xcode New build / legacy build.
  • Xcode managed profiles / Manual profiles.
  • Hybrid stack, xcode 9, xcode 10, xcode 10.1, xcode 10.2.
  • Tested 2 x Generate cordova build configuration steps (1 for each profile).

Other variants tested:

  • Various Cordova versions.
  • Dependency versions.
  • Node versions.
  • Ionic versions.
  • Removed all other plugins.

The result is always the same! Bitrise just isn’t seeing or assigning the correct profile for the ShareExt.

Can anyone help???

0 Likes

#2

Hello there!

If you can build it locally via xcode, could you look for the exportOptions.plist file in the ipa and copy it’s content to the xcode archive step’s debug section input 1? it will override verything and build according to that. the only thing that you have to rewrite if so the signing style must be manual.

0 Likes

#3

We’re using Ionic Archive. I wasn’t able to use the Xcode Archive step because the /platforms folder does not exist on the server. With Ionic projects, /platforms, /plugins and /node_modules are all generated during the build, so I don’t know what to do!

0 Likes

#4

oh sorry this is my mistake.
Could you please send me the latest failing build’s url please? so I can check the logs and try to come up with something (relevant😅)?

0 Likes

#5

Here’s a build using the correct provisioning profile for the ShareExt in the code:

https://app.bitrise.io/build/060158c9246b2160

0 Likes

#6

as far as I see now, you have the correct profile up, just use the wrong one in the generate cordova buld config step, use this profile in there 77d155da-8c85-4971-b869-ac8ec915b81e

0 Likes

#7

Sorry, I think this particular build had 2 x Generate cordova build configuration steps. One for each profile. Even if we only use this step once for the main profile, we get the same result.

0 Likes

#8

Could you please send a url like that as well please? :upside_down_face:

0 Likes

#9

https://app.bitrise.io/build/d60098c310a8b13b

In case you’re wondering, here’s the plugin installation guide:
https://www.npmjs.com/package/cc.fovea.cordova.openwith#installation

Using this guide, I’ve assigned the correct profile for the plugin in the code (config.xml + package.json)

0 Likes

#10

Hi @remko_spinij !

It seems I managed to fix the code signing issue:

  • Set the configuration to release in the Generate Cordova build configuration & Ionic Archive steps.
  • Re-add the default options for Ionic Archive: -- --buildFlag="-UseModernBuildSystem=0" (this is needed, because Ionic doesn’t support the new Xcode build system)
0 Likes

#12

It looks like that particular build was an anomaly. It was one of many tests and seems to produce a white screen.

I’ve just created a fresh Ionic 4 starter project and added only the cordova.openwith plugin and it’s failed.

I’ve tested all sorts of things! Here’s the latest build:
https://app.bitrise.io/build/e1def34a41c33531

Tested with debug and release.

It works via Xcode locally, but only if I delete the node_modules, plugins and platforms folders and run npm i followed by ionic cordova build ios --prod

0 Likes

#13

Hello @remko_spinij,
Please run ionic cordova platform rm ios and ionic cordova platform add ios` and make sure to commit the config.xml file. Relevant log lines:

e[32;1m$ ionic "cordova" "prepare" "--no-build"e[0m
✔ Creating ./www directory for you - done!
[WARN] No platforms added to this project. Cannot prepare native platforms without any installed.

A possible solution could be to commit the platforms and plugins directory to the repo, this way one could makes sure that the native Xcode project file is buildable.

An other way is to edit the Xcode project file from a script step (by adding the ionic-prepare step, which mostly restores platforms and plugins) or by creating a ionic plugin.
Still this is not neccessary in the simplest case. I managed to build a simple project using:

  • ionic start
  • edited the app id to make it unique in config.xml
  • ionic cordova platform add ios
  • Used wildcard provisioning profile;
    Added a build.json to set team ID (and optionally provisioning profiles) for cordova:
{
    "ios": {
      "debug": {
        "developmentTeam": "72SA8V3WYL"
      },
      "release": {
        "developmentTeam": "72SA8V3WYL"
      }
    }
  }
  • Added share extension plugin, note that you can specify team and privisioning profile: cordova plugin add cc.fovea.cordova.openwith --variable IOS_UNIFORM_TYPE_IDENTIFIER=public.image --variable IOS_URL_SCHEME=ccfoveaopenwithdemo --variable SHAREEXT_DEVELOPMENT_TEAM=72SA8V3WYL
0 Likes

#14

Hi @laszlo.pusok,

ionic cordova platform rm ios and add did not work.

Provisioning profiles are correctly added in Bitrise via Generate cordova build configuration.

The share extension plugin already specifies in the code:
IOS_URL_SCHEME
IOS_UNIFORM_TYPE_IDENTIFIER
SHAREEXT_DEVELOPMENT_TEAM
IOS_GROUP_IDENTIFIER
SHAREEXT_PROVISIONING_PROFILE

I looked at wildcard provisioning profiles but I can’t add any of the services we require.

So I still can’t build the app!!

0 Likes

#15

This should be done on the development machine. What was the problem?

Generate cordova build configuration you can not add multiple provisioning profiles by adding more then one of this step.

If can not use wildcard, can specify the provisoning profiles in build.json and the plugin config. In this case the share extension ID could be wrong, so that needs a fix.
Commiting the platform and plugins dirs could work, in addition of setting the run_prepare flag to false.

0 Likes

#16

Hi @laszlo.pusok,

I actually added ionic cordova platform add ios in the script step which solved the warning

[WARN] No platforms added to this project

but it did not solve the problem.

I’ve just committed the /platforms and /plugins folders to see if that helps. I’ll let you know the outcome!

0 Likes

#17

Hi @laszlo.pusok

Success! It’s now building in Bitrise!! Thank you :slight_smile:

As per your advice:

  1. I built locally then committed the /plugins and /platforms folders to my repo.
  2. Added ionic cordova platform rm ios and ionic cordova platform add ios to the script step in Bitrise.
  3. Removed the specific ionic version I’d set previously in Ionic archive.

And success!

Thank you again!

0 Likes