Error when using downloaded example code: Failed to register bundle identifier

Hi there,
I am a total newbie to software development with swift, so maybe this is quickly answered.

I am running Xcode 11.1 on macOS Catalina 10.15. Everything seems to work fine, when I write my own code from scratch. However, when I download examples from Apple (as for instance recommended in Chris’ tutorial “Swift UI Navigation & Lists”) I cannot build and run the code due to the following error:

Failed to register bundle identifier. The app identifier “com.example.apple-samplecode.Landmarks” cannot be registered to your development team. Change your bundle identifier to a unique string to try again.

I tried to change the bundle identifier, but it seems that I do not fully understand where it has to be changed and to what I need to set it.

In “Signing & Capabilities” signing is automatically managed, the team is my Name (personal team) and the signing certificate is Apple Development: myAppleID

Thanks for any help
jg

2 Likes

You should typically change it to what you’re registered for as a dev.

Meaning mine is com.mikaelacaron.app-idea

This will be located in the project settings, so click on the project on the left (by all the folders) and then it’s under General I think

Hey Joerg, welcome to the forum! Yep, i would try Mikaela’s suggestion and change the bundle ID in the project properties screen. Here’s a screenshot:
CloudApp

Thanks Mikaela and Chris,
your solution did not work for me, but I think I understood it now and it is not a problem any longer – please tell me, if the following is wrong.

First of all, the code builds and runs fine with the bundle identifier from apple as long as I am using the simulator. With my own code I directly used the app on my iPhone or iPad and that also works fine for my own bundle identifier. However, I have a developer account, but I am not part of Apple’s developer program (I understood this cost money and it is only needed, when I want to put an app on the App Store, right?). For this reason my provisioning profile is somehow restricted I guess.

Anyway, for some reason Apps that I write from scratch can be used on my devices, but the examples from Apple seem to run only in the simulator – which is fine by me. So I consider this solved.

Hey Joerg, yeah it only becomes an issue when you need to run it on your device!

@joerg Follow this link to run your iOS test on Real device.