Change Your Bundle Identifier to a Unique String and Try Again

Every developer new to Cocoa and Swift development needs to get familiar with Apple's lingo and processes. In today'southward tutorial, I'd like to talk about App IDs and packet identifiers. What is an App ID? What is a parcel ID? And what's the link between App IDs and bundle IDs?

Bundle Identifier

A packet ID or bundle identifier uniquely identifies an awarding in Apple's ecosystem. This means that no two applications tin can accept the aforementioned bundle identifier. To avoid conflicts, Apple tree encourages developers to use reverse domain name notation for choosing an awarding'due south parcel identifier.

Permit'southward have Cocoacasts as an example. Every application I build for Cocoacasts has a bundle identifier that starts with com.cocoacasts, that is, the reverse of the Cocoacasts website. For my company, Code Foundry, I use bundle identifiers that start with be.codefoundry.

You don't need to own the domain you utilise for your application's packet identifier. The domain is only used to ensure the bundle identifier is unique. For example, I could as well apply blog.cocoacasts for the applications I build for Cocoacasts even though I don't own cocoacasts.web log.

To create a unique bundle identifier, you append the proper noun of the awarding to the reversed domain, for instance, com.cocoacasts.scribbles. Recollect that you cull the bundle identifier. Reverse domain name notation is what Apple recommends and it's a pattern about developers apply.

The just requirement is that the bundle identifier is unique. Xcode warns you if yous cull a package identifier that'due south already in apply by another application. I strongly recommended that yous use a package identifier that makes sense and that'south why well-nigh developers stick to reverse domain name annotation.

If you're edifice a suite of applications, and then yous can apply the same approach. Take a look at the post-obit case. The beginning bundle ID is used for the iOS client of Scribbles whereas the second bundle ID is used for the macOS client of Scribbles.

          com.cocoacasts.scribbles.ios com.cocoacasts.scribbles.macos                  

App ID

Developers often confuse App IDs with bundle IDs or, fifty-fifty worse, they call up they're the same thing. An App ID represents one or more than applications in Apple's system. It consists of two components, a Team ID and a package ID search string.

In this example, ABCDE12345 is the Team ID and com.cocoacasts.scribbles is the package ID search string. The Squad ID and the packet ID search string are separated past a period.

          ABCDE12345.com.cocoacasts.scribbles                  

The Team ID is the component y'all don't need to worry about is. It's generated by Apple and prepended to the package ID search string.

What is a bundle ID search cord? This question takes united states of america dorsum to parcel identifiers. It'south possible to employ one App ID for several applications. That's where explicit and wildcard App IDs come up into play.

The bundle ID search cord of an App ID can match a single application or, by including a wildcard, it tin lucifer multiple applications of the same development squad. Let me show you an example of each App ID type.

Explicit App ID

As the name implies, an explicit App ID doesn't incorporate a wildcard. The bundle ID search string matches the parcel identifier of 1 application.

          ABCDE12345.com.cocoacasts.scribbles                  

The Team ID, ABCDE12345, is generated past Apple tree for your development team. This isn't something you tin or should change. The parcel ID search string, com.cocoacasts.scribbles, doesn't incorporate an asterisk. In other words, the parcel ID search string matches the bundle identifier of i awarding, the awarding with a parcel identifier of com.cocoacasts.scribbles. An explicit App ID can simply be used for i application.

Wildcard App ID

A wildcard App ID is a bit different in that it can be used for one or more applications. The App ID tin can be used for every application with a bundle identifier that matches the App ID'due south bundle ID search string.

          ABCDE12345.com.cocoacasts.*                  

The above App ID can be used for several bundle identifiers. The asterisk or wildcard indicates that anything following com.cocoacasts. can be variable.

          com.cocoacasts.scribbles com.cocoacasts.scribbles.ios com.cocoacasts.scribbles.macos                  

What Are App IDs For

You already know that a bundle identifier uniquely identifies an application in Apple tree's ecosystem. What is the purpose of an App ID? An App ID links one or more applications from a evolution team in Apple'southward system. Why is this important?

Whenever you want to enable a adequacy or awarding service for your application, you enable that adequacy for the App ID your application is linked to. This used to be tedious, requiring a visit to Apple tree's programmer website. Xcode has evolved quite a scrap over the years and it takes care of the details about of the time. Permit me show you how this works.

App IDs and Capabilities

Setting Upward the Project

Burn up Xcode and create a new project based on the Unmarried View App template.

Setting Up the Project

Name the project and set the System Identifier using contrary domain name notation. The organization identifier is used to create the get-go component of the application's bundle identifier. Project'due south name is appended to the organization identifier to create the packet identifier. Don't worry. Yous tin change this later on setting up the project. For instance, I prefer to proceed the parcel identifier lowercased.

Setting Up the Project

Once you lot've created the project, y'all tin see the details of your application in the Full general tab of the target.

Inspecting the Bundle ID

Keep in mind that you can't alter the bundle ID whenever you lot feel like. In one case your awarding is pushed to Apple tree'due south App Shop, it's no longer possible to change your application'due south package ID. Choose your bundle ID carefully.

Xcode also shows us the Team ID I mentioned earlier. Notice that you're unable to alter the Squad ID. You shouldn't need to worry about this.

Enabling Capabilities

Permit'south say we want to enable iCloud for our application. For that to piece of work, we need to inform Apple tree that our application needs the iCloud capability.

Years agone, this meant a visit to Apple tree's programmer website, creating an App ID, and flipping a switch. This is no longer necessary. Open up the Capabilities tab in Xcode and flip the switch of the iCloud department.

Enabling the iCloud Capability

Xcode jumps into activeness, talks to Apple tree'due south developer portal on your behalf, and takes intendance of the necessary steps.

Enabling the iCloud Capability

Xcode shows us what tasks information technology performed on your behalf. Have a look at the bottom of the iCloud section in the Capabilities tab.

Enabling the iCloud Capability

Visiting Apple tree'due south Developer Website

Let'due south make sure everything is set correctly on Apple tree'south servers. Open up a browser and visit Apple'southward developer website. Click Business relationship and sign in with the Apple ID that'south linked to your developer account.

Visiting Apple's Developer Website

On the left, select Certificates, IDs & Profiles.

Certificates, IDs & Profiles

From the menu on the left, choose App IDs and look for the App ID Xcode created for united states. App IDs generated by Xcode start with the letters XC to indicate that Xcode created those on your behalf.

Click the App ID and inspect its configuration. It gives you an overview of the capabilities and applications services of the App ID in the evolution and production environments.

Configuring the App ID

Notice that iCloud is enabled considering we enabled this adequacy from within Xcode. Some capabilities and awarding services are enabled by default, such as Game Centre and In-App Purchase.

Manual Configuration

Yous can manually configure an App ID through Apple tree'due south developer website, and that may be necessary from time to fourth dimension. For case, you can but link SSL certificates to an App ID for push button notifications through the developer website. This isn't possible from inside Xcode at the fourth dimension of writing.

Cull Wisely

It'south important that you take a few moments when you choose the bundle ID of your awarding. One time your application is in the hands of users, you're unable to make changes to the bundle ID. While this isn't something users pay attention to, yous don't desire to have a package ID that makes no sense. Stick with Apple's guidelines and you lot should exist fine.

Most companies include the visitor's name in the bundle identifier and that makes sense. But remember that the bundle identifier cannot be modified even if the application changes easily, for example, in the event of an conquering.

If you lot're a freelance programmer or you run an bureau, make certain you lot don't include your proper name or that of your company in the bundle identifier. Discuss this with the customer and brand certain you lot choose a bundle identifier that makes sense for the projection and the owner.

zeiglerthemblent.blogspot.com

Source: https://cocoacasts.com/what-are-app-ids-and-bundle-identifiers/

0 Response to "Change Your Bundle Identifier to a Unique String and Try Again"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel