Enabling Security and Protection for Apps


Navigate to the iOS Dev Center and sign in with your username and password.After you are signed in, find the iOS Developer Program section and choose Certificates, Identifiers & Profiles.
On the lefthand side of the screen, find and navigate to the App IDs section of the portal and press the plus button (+) to create a new App ID. IntheNamesection,enterthename“SecurityApp.”Youcanactuallyenteranything you want, but to avoid confusion in this chapter, it’s best to stick with the afore‐ mentioned name, which I will be using in examples.UndertheAppServicessection,checktheDataProtectionboxandensurethatthe Complete Protection option is selected. Leave the rest of the settings intact.
UndertheAppIDSuffixsection,ensurethattheExplicitAppIDoptionisselected, and in the Bundle ID box, enter the dot-separated name of a service. I recommend com.NAME.ios.cookbook.SecurityApp, where NAME is your company’s name. If you don’t have a company, make up a name! I am using com.pixolity.ios.cook book.SecurityApp in examples, but you need a unique name, so you can’t use mine.
After you are done, press the Continue button.You should now be asked to confirm your settings before your App ID is created,similar to the screen depicted in bellow Figure
Choosethedevelopmentcertificate(s)towhichyouwanttolinkyourprofile.Then press the Continue button.Choosethelistofdevicesonwhichyourprofileisallowedtobeinstalled(onlyfor Development and Ad Hoc profiles, not for App Store). Press the Continue button.
On the next screen, where you are asked to specify a name for your profile, enter something along the lines of “SecurityApp Dev Profile” and then press the Generate button to create your provision profile. Your profile is now ready to be downloaded (below figure). Press the Download button to download your profile.
To install the profile, drag and drop the downloaded profile into iTunes. This will install the profile with its original name into the ~/Library/MobileDevice/Provision ing Profiles/ folder. I have seen many iOS developers install a provision profile by double-clicking on it. While this does work, in that it installs the profile into the aforementioned folder, it will destroy the original profile’s filename and will install the profile using the SHA1 hash of the profile. If you later go into the aforementioned folder, you won’t be able to tell which profile is which unless you look inside the profiles for their names, so I strongly discourage this way of installing profiles. It’s best to either drag and drop the downloaded profiles into iTunes or manually paste the profiles into the aforementioned folder.
Brilliant. You now have the provision profile installed on your computer. Use the build settings of your project to make sure that the correct profile is selected for the Debug scheme. After you follow the same process for creating your Ad Hoc and App Store profiles, you can ensure that your app is built with the correct Ad Hoc or App Store profile for the Release scheme.
The provision profile that you created now will allow you to debug your apps on an iOS device and store data onto the disk or into the keychain with ease.