5

When I try to build the BreakfastFinder Sample Code from Apple, it will build it for Simulator but not for my iPhone X with IOS 13(Public Beta 3).

I tried Unpair and repair the Device, switching the identifier from "com.example.apple-samplecode.BreakfastFinder" to com.<myID>.TestApp2

Downloaded the Project Sample from here: https://developer.apple.com/documentation/vision/recognizing_objects_in_live_capture

and only after a crash I changed the Build Identifier.

I expect the Build to Finish and Run, but it gave me these errors. Both Errors from Xcode:

  1. Failed to register bundle identifier. The app identifier "com.example.apple-samplecode.BreakfastFinder" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
  2. No profiles for 'com.example.apple-samplecode.BreakfastFinder' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.example.apple-samplecode.BreakfastFinder'.
MGY
  • 7,245
  • 5
  • 41
  • 74
Philipp NXT
  • 53
  • 1
  • 1
  • 8
  • please, also check my answer (https://stackoverflow.com/a/63578106/4145420) for a more elegant solution. – MGY Aug 25 '20 at 11:48

4 Answers4

3

In the project directory, look for the file Configuration > SampleCode.xcconfig

In there you'll see on line 13:

SAMPLE_CODE_DISAMBIGUATOR=${DEVELOPMENT_TEAM}

Replace ${DEVELOPMENT_TEAM} with your own team name

SAMPLE_CODE_DISAMBIGUATOR=your_team_name

That worked for me

seantomburke
  • 10,514
  • 3
  • 18
  • 23
  • If you don´t know where to find `your_team_name` here you can find it [Answer from other Thread](https://stackoverflow.com/a/47732584/11817654) – Philipp NXT Aug 02 '19 at 18:58
  • this didnt work for me in: https://github.com/appium/ios-uicatalog/tree/master/UIKitCatalog @PhilippNXT – Tim Boland Aug 20 '21 at 05:50
3

Permanent Solution

  • If you'll add SAMPLE_CODE_DISAMBIGUATOR key under your target's Build Settings as a User-Defined entry, then you don't need to add your Development Team manually in SampleCode.xcconfig file.

  • When you select the team under Signing & Capabilities it'll automatically fill the Development Team under the SampleCode.xcconfig file.

MGY
  • 7,245
  • 5
  • 41
  • 74
0

This worked for me when I put that in the SampleCode.xcconfig file the following:

SAMPLE_CODE_DISAMBIGUATOR=3323GT3XP
Ronye Vernaes
  • 2,444
  • 1
  • 17
  • 21
ioopl
  • 1,735
  • 19
  • 19
0

This approach is used by Apple for sample codes. I found it in the Soup Chef project where they demo how to set up Siri Shortcuts and donate intents.

If you open the Configuration/SampleCode.xcconfig file, you will see:

The SAMPLE_CODE_DISAMBIGUATOR configuration is to make it easier to build and run a sample code project. Once you set your project's development team, you'll have a unique bundle identifier. This is because the bundle identifier is derived based on the 'SAMPLE_CODE_DISAMBIGUATOR' value. Do not use this approach in your own projects—it's only useful for sample code projects because they are frequently downloaded and don't have a development team set.

You can verify it yourself: For example in the case of SoupChef, SoupChef.xcodeproj/project.pbxproj contains lines like these:

PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.SoupChef${SAMPLE_CODE_DISAMBIGUATOR}";

Now, you need to lookup the team. As others mentioned in the comments, you can look it up following this thread.

As I see, you can actually use any disambiguator, the only important thing is that it's unique to you. However, you might want to just stick to their recommendation and lookup your team ID as it reduces the risk of some unknown issue popping up later.

Make sure you read and follow the other instructions in your sample code's description.

I still had to go through all the targets and select the team in the "Signing & Capabilities" tab, but I didn't have to manually modify the bundle identifiers for each target.

In my example project, the app groups had to be set manually in a couple of targets, too, and I had to edit a Swift file Shared/Support/UserDefaults+DataSource.swift.

Once all those things were updated, I could build and launch the app on my mobile phone.

Vince Varga
  • 6,101
  • 6
  • 43
  • 60