Debug rows missing from Code Signing and Provisioning Profile sections - xcode

The problem:
With All/Combined selected from the top menu within either the Project or the Target, this is what I see. Debug used to be listed within the Provisioning Profile and Code Signing Identity sections, but it is now missing. I can build a run on the simulator like this but when trying to deploy to a tethered testing device I get errors about provisioning profile and code signing being required.
This is not a duplicate of 'Provisioning profile' options missing from 'Code signing' Xcode 6.3 because I have All/Combined selected. It's not just that Debug is not visible in the list... it doesn't even exist anymore in the project.pbxproj file that Xcode uses to build the list.
What caused it:
I was trying to remove a profile in Xcode 7.3.1 and pressed the delete key without realizing the root debug row was selected rather than the child row which holds the profile itself. I can add a child (e.g. a release type such as Any iOS SDK) to a Release or Debug row by hovering over the parent row and clicking the +, but I can't add a new root item like Debug that way. No + is available when hovering over the Code Signing or Provisioning Profile rows. Unfortunately, while I can't remove one of these root rows with the mouse (no - button on them), I can accidentally do so with the delete key – which is what led to this broken state.
What I've tried:
Cleaning, restarting Xcode and computer, reinstalling Xcode, upgrading to Xcode 8, migrating to Swift 2.3, migrating to Swift 3, etc. I used a text editor with JSON syntax highlighting to opened multiple versions of the project.pbxproj file (some before the deletion) to see the differences. The project.pbxproj file is used to generate the menu items for the project and target. The old version is missing many new settings for the Release section found in the new version now that it has gone through several upgrade iterations with Xcode and Swift migrations. Among other concerns with that file, I wouldn't even know what was missing from the Debug section I'd be trying to add back. I could start a fresh project and copy over the Debug section from it's project.pbxproj file, but I'm convinced that manually editing that file to try to add the debug items back is a bad idea. There's probably a better option.
Question:
What's the best way to restore the missing Debug menu items?

What I would suggest is to create "manually" the new Debug configuration. You will not restore your old configuration but you will be able to set the correct configuration for the Debug configuration.
The operation is described in Adding a build configuration in Xcode but in your case you will have to duplicate the Release configuration and edit it to fit your requirements.
I also guess you will have to edit your schemes to use the correct configuration for each action (build/run/...).

Related

How to get release configuration back

I deleted all the Release configurations in Xcode and now have only Debug. Is there a way to create another release configuration? I am looking to get Xcode to look like the image below.
There's no way to directly recreate the lost Release configuration.
You have two painful options:
Create a new project and copy all of your files from your existing project to your new project.
Copy the Debug configuration in the project with the missing Release configuration. Name the copy to Release. Then update all of the Build Settings for the new Release configuration.
Option 2 can be done by clicking the + icon just below the screenshot shown in the question. Then select "Duplicate "Debug" Configuration". Give the new configuration the name of "Release". The trick now is knowing what all of the release settings need to be. Create a new dummy project using the same template you used for your actual project. Then select the project and then the Build Settings tab. Choose the "Customized" and "Levels" options. Now scan down the list to see where it shows different values for Debug and Release. Make those same changes in your actual project.
As you can see in the picture below, the Build Active Architecture Only, Debug Information Format, Enable Testability, etc. settings are different between Debug and Release.

How to re-add deleted build settings

XCode 7 has allowed me to delete a couple of project settings. How can I add them back?
Here's a picture of before and after...
The projects settings aren't really gone completely, only your overrides of the default values were deleted.
So if you go to the All tab next to the Basic tab in your screenshots, you will see the Base SDK and Build Active Architecture Only entries. But you will have to set them again to the custom values you like.

Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

Until Xcode 5, Release builds could be prevented from including NSAssert statements and their variants, using the default Build Setting:
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
This setting can be found in project.pbxproj and is set in Xcode here:
(Note that this grab was taken from an Xcode 4 project converted to Xcode 5.)
Each target would inherit this setting in the Release build only. Obviously this was a good thing. Rather than crash immediately, the app would possibly struggle on regardless. Whereas for Debug builds, you want to know immediately when an NSAssert fails.
However, I am struggling to find the equivalent in Xcode 5.
Creating a new project using the default templates shows no equivalent setting:
My question is, what is the equivalent setting in Xcode 5, or does NS_BLOCK_ASSERTIONS have to be added manually to Other C Flags for the Release build?
It's got it's own setting field now! Enable Foundation Assertions. Set your debug as yes and your release as no, as shown in screen grab below.
Note: You need to click All in the top left in your build settings tab to see it, you can see in my screen grab the blue ALL in the top left.

Xcode5 "No matching provisioning profiles found issue" (but good at xcode4)

Everything is OK on Xcode4.6. When I try to use Xcode5 dp6 to run app on devices. I got an error of "No matching provisioning profiles found issue". How can I resolve this issue?
Don't forget to change profile in Provision Profile sections:
Ideally you should see Automatic in Code Signing Identity after you choose provision profile you need. If you don't see any option that's mean you don't have private key for current provision profile.
What really confused me was that there are two different sets of build settings:
1) for the Project
2) for the Target
In the sidebar (top left) there is a blue icon that represents your project. Click that:
Then in the main panel to the right, in the top bar, just to the left of the word, "General," there is a small icon of your Project. Click that, and now select the Target in the pop-up menu that appears:
Once you've selected the Target, now the build settings for the target can be changed. They are different than the ones for the Project itself... weird! I'm not sure why there are build settings for the Project as a whole, that are different from the Target, since the Target's settings are what gets used during building. So why even have settings for the Project? Not sure.
But that's how you change them. This solved the issue for me: go into the Target (not the Project!) under Code Signing > Provisioning Profile > and change the settings to the proper profile. For a long time I was just changing them in the Project only, since I didn't know I was supposed to select the Target, and I kept having this issue. This fixes it!
Setting your provisioning profile moved. It confounded me for a while until I found it also.
Select your project file (to open target)
Click on the "Build Settings" tab
Scroll down to "Code Signing" and see the new "Provisioning Profile" section there.
OK - all answers provided above are correct to some extend, but did not resolve this issue for me. I'm using Xcode5.
There are lots of threads around this general error but from what I read this is a bug in Xcode dating back to 3.x versions that can randomly create conflicts with your Keychain.
I was able to resolve this by doing the following:
Open Xcode -> preferences -> Accounts: delete your developer account
Open Keychain: Select Keys, delete all iOS keys; Select My Certificates, delete all iPhone certificates
Navigate to '/Users//Library/MobileDevice/Provisioning Profiles', delete all files (this is where Xcode stores mobile profiles)
Open Xcode -> preferences -> Accounts: re-add your developer account
Navigate to Project properties, Target, General Tab and you should see the following
Click 'Revoke and Request' (I tried this, it may take a few min) or 'Import Developer Profile' (or download from Apple developer portal and import this way, should be faster..)
FINALLY: you can go over to Build Settings and set 'Provisioning Profile' and 'Signing Settings' as described by everyone here..
Doing this and only this resolved this error for me.
Here's a simpler solution that worked for me:
In XCode5, double-click on your app's target. This brings up the Info pane for the target. In the "Build Settings" section, check the "code signing" section for any old profiles and replace with the correct one. update the value of "code signing identity" and "provisioning profile"
Sometimes, especially after generating a new certificate or starting to use a new code signing identity, there seems to be no other way to fix this, other than doing some cleaning the .pbxproj file. This is probably a bug that will be fixed, so if you are reading this long after this post, maybe you should try some other solution.
There is an excellent post about this in the pixeldock blog:
http://www.pixeldock.com/blog/code-sign-error-provisioning-profile-cant-be-found/
In short, mostly quoting from that article, you need to:
Make sure you have fetched all your remote iTunes Connect certificates in xcode5 from Preferences, Accounts, (select your account), View Details, press refresh button. (Normally, I answer no when xcode asks if I want to create certficate signing requests, it's not necessary when you only want to download/refresh your certificates)
Close Xcode
Right click on your project’s .xcodeproj bundle to show it’s contents.
Open the .pbxproj file in a text editor of your choice (make a backup copy first if you feel paranoid)
Find all lines in that file that include the word PROVISIONING_PROFILE and delete them.
Open Xcode
Enter your target and select the provisioning profile that you want to use.
Build your project
Good luck!
In xcode5 from Preferences, Accounts, (select your account), View Details, press refresh button. then select Provision Profile in build settings.
In my case the "Fix Issue" button triggers a spinner for about 20 seconds and fixes nothing.
This works for me (iOS 7 iPhone 5, Xcode 5):
Xcode > Window > Organizer > Devices
Find the connected device(with a green dot) on the left pane.
Select "Provisioning Profiles"
On the right pane, there is a line with warning.
Delete this line.
Now go back to click the "Fix Issue" button and everything is fine - the app runs in the device as expected.
I have 2 targets in my project, Free and Paid.
My mistake was i was looking at my free target while trying to build the paid target, a stupid mistake but possible someone out there might learn from this as well.
I get the same question as you you can click here :
About the question in xcode5 "no matching provisioning profiles found"
(About xcode5 的no matching provisioning profiles found )
When I was fitting with iOS7,I get the warning like this:no matching provisioning profiles found.
the reason may be that your project is in other group.
Do like this:find the file named *.xcodeproj in your protect,show the content of it.
You will see three files:
project.pbxproj
project.xcworkspace
xcuserdata
open the first, search the uuid and delete the row.
All of drop down lists disappeared in Build Settings after running the Fix Issue in Xcode 5. Spent several days trying to figure out what was wrong with my provisioning profiles and code signing. Found a link Xcode 4 missing drop down lists in Build Settings and sure enough I needed to re-enabled "Show Values" under the Editor menu. Hopefully this helps anyone else in this predicament.
Also, I had to clear my derived data, clean the solution and quit and reopen Xcode into for the code signing identities to correctly appear. My distribution provisioning profiles where showing up as signed by my developer certificate which was incorrect.
I had the same error today, with XCode 6.1
What I found was that, no matter what I tried, I couldn't get XCode to stop complaining about this Provisioning Profile with a GUID as its name.
The solution was to search for this GUID in the .pbxproj file, which lives within the XCode .xcodeproj folder.
Just find the line containing your GUID:
PROVISIONING_PROFILE = "A9234343-.....34"
and change it to:
PROVISIONING_PROFILE = ""
One other thing to check: Your XCode PROJECT settings contain your Provisioning Profile & Code Signing settings, but, there is a second set under your project's "TARGETS" tab.
So, if XCode is complaining about a Provisioning Profile which isn't the one quoted in your project settings, then go have have a look at the settings shown under "TARGETS" in your XCode project.
(I wish someone had given me this advice, 4 painful hours ago..)

How delete the config in Build Settings in a low level in XCode 4

In XCode 4.0.2 there is a good way to configure the program in Build Settings when you click in "Levels" format. Like this screen
The levels are in this way:
Target Settings
Project Settings
iOS Default Settings
So the XCode see if the Target have a config, if not see in project and if not use the iOS default.
The problem here is that when you set a config in a low level and than delete it, it's impossible use the config of a upper level.
Like in image. I set all targets to use Google in Current Project Version, but in this target I want it use stackOverflow and it work. But in the other Generated Versioning ... I first config with stackOverflow but change my mind and want to use the Project Settings. Now is impossible delete the Target Settings and I will have to enter it manually.
How can I delete the target setting to use the project setting?
In xcode 5 it worked right simple for me. I had the same situation as in the picture in the question. Some data in the project setting and an empty but green setting on target level.
You have to select the line e.g. with the mouse that is marked and afterwards press the delete button the green marking is gone from the target level. In my test it and it will never delete the setting on the highes level, so there is no risk.
Click the Combined button and change the build setting value. Now when you click the Levels button, you will see the target and project both have the new value for the build setting.
I just figured this out. It's a little sketchy, but it works, and does not feel dangerous to me (particularly if you're using version control).
In Xcode, delete the text from the target-level configuration. Make sure you still have it defined at the project level.
Look at a diff of the YourProjectName.xcodeproj/project.pbxproj so you can figure out the code-level name of the setting you just changed. For example, in Xcode, I deleted the text from my target-level configuration for "Other C Flags". My diff showed the OTHER_CFLAGS setting changing from OTHER_CFLAGS="mytargetlevelsetting" to OTHER_CFLAGS="". If you're using version control (which you should be), it'll be easy to get this diff.
Quit Xcode.
Open up YourProjectName.xcodeproj/project.pbxproj in a text editor. Find all the lines starting with the setting name you found in step 2. Delete all the ones where the value is an empty string, and keep all the rest. For example, I deleted all the lines that said OTHER_CFLAGS="", but kept all the lines that said OTHER_CFLAGS="settingiwanttokeep". If you don't see any where the value is an empty string, or all their values are empty strings, you probably didn't follow step 1.
When you reopen Xcode and look at your target's build settings again, the setting in question should be using the project-level configuration, not the target.

Resources