Instruments stopped working on iPhone apps - ios

I had used Instruments tool (an Xcode developer tool) to analyze iOS applications before with no issues. But now when I try to run it on any iOS app (for instance CNN), it is giving me following error.
"Target failed to run: Permission to debug com.cnn.iphone was denied. The app must be signed with a development identity (e.g. iOS Developer)."
Is there any work around? Is it not supported anymore in new version of Xcode? Few months ago, I was able to use it on all applications including CNN.

Just edit a Profile section in target scheme. Switch Build Configuration to Debug.

Assuming that you are using the Release configuration to run in Instruments (as recommended), you need to review the code signing and make sure that Release is configured to use your Developer identity (instead of Distribution, for example).

First click your target
Choose Edit Scheme...
Select Profile and make sure Build Configuration is what
Here, my Build Configuration of Profile section is AdHoc. Don't change this selection to Debug, cause in Debug mode, it won't be optimized by compiler like AdHoc or Release.
Then come to Build Settings, change the Certificate and Provisioning Profile.
From this picture
To this picture
It's done!

The application (one wants to run Instruments libraries on) has to be in running state and then select from the 'Running Applications' category and not from the 'Installed Apps' category and that should work.

Related

Xcode 8 A valid provisioning profile for this executable was not found

I know there are other questions asked like this here but I've followed all their solutions yet still end up with this error message.
I have a valid Apple Developer account with program active.
I have tried using managed and unmanaged provisioning with new/fresh bundle ID's (which get recreated provisioning profiles).
I have tried this: A valid provisioning profile for this executable was not found for debug mode
I have tried this: XCode :7 App installation failed :A valid provisioning profile for this executable was not found
I have deleted any old versions of the app from my phone.
I have confirmed my device ID on the developer portal is the same as in Xcode (was also useful for manual provisioning profile management to confirm)
I even tried another developer ID I have out of sheer desperation and yet the same error appears.
I even get this error when building for release scheme with my valid distribution certificate.
I've spent a ton of time trying to figure this out now I'm hoping someone else has felt my pain and actually solved this.
UPDATE: Adding screenshots for usefulness
UPDATE 2: I gave up trying to solve this problem, I created a new project and copied source files into the new project and I now have it working. Clearly something in the project configuration/settings files got corrupted somehow in the previous project which no obvious fix available. Will leave this question open, perhaps someone has a solution eventually. I have my old 'non-working' project so will continue to try those just for curiousities sake.
Before this error message, Build Succeeded is shown.
ATTENTION!
Who should read
If you were developing with a "Personal Team" and is switching to a paid team, then you'll get this error if you have not updated your other targets as well.
The cause
Since I'm using react-native, I happen to have a target for test (i.e. a target called appTests), and switching the team just in one target wasn't sufficient, and leads to this error. This error isn't informative enough to let you know there's an error in one of the targets, therefore leading to a long debugging time for myself.
Solution
1) On Xcode 9, go to every targets and update the team!
2) Unfortunately, the next steps aren't very reliable from my experience, you might have to do your best to clean the caches.
3) Stop every single running scheme/application by using the stop button
4) Go to Product -> Clean and cleans every schemes you use.
5) Quit and Restart Xcode
6) Run again and hopefully it works! If not, it's likely some cache are still present.
You can't install a build that was signed with the app store distribution provisioning profile and certificate (I'm assuming your release scheme is set to use your app store cert and profile). It will fail to install on the device if you try. You need to use either a development profile, or an enterprise distribution profile to install on test devices. The iOS Distribution certificate can only be used to build an app that will be installed via the App Store.
Thats a conflict of Xcode. The way I solved it is by deleting the derived data of Xcode.
Xcode > Preferences > Locations
You will see an arrow right from the path of the DerivedData which will open them in finder. Just erase everything in the folder.
Update: According to Chandler's comment check if there is a need to delete the test target.
I solved it by changing the build system to legacy in Xcode 10
File > Workspace Settings > Set Build system to "Legacy Build System"
It works when I also add the correct signing for myProjectTests. This was the last thing I did after trying all sort of solutions for 5 hours.
I followed many proposals but it didn't work until I unchecked Automatic signing for the TESTS
Clearing the DEVELOPMENT_TEAM and DevelopmentTeam entries in the xcodeproj/project.pbxproj file worked for me.
I'm on 8.2.1 and just had this same error. Deleting the original project folder and recreating it worked seamlessly. I verified that all of the signing and provisioning certificates were exactly the same as the last project. I'm not sure where the issue lies, but I believe your assumption of corrupted files is accurate.
In my case it was a conflict with the development team.
I've solved by opening my xcodeproj/project.pbxproj and emptying the following variables:
DevelopmentTeam
DEVELOPMENT_TEAM
We had a similar issue: we deleted the Unit Tests and it worked.
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting -> General -> Date & Time -> set time automatically
GOTO: Targets->yourProjectNameTest and verify that team is the same as on yourProjectName
I had this problem too, and for me the solution was to sign in to https://developer.apple.com. There was a red bar, going like "our TOS have changed, you have to accept them again", I did, and then my provisioning profiles worked again immediately.
An easier fix is to uncheck the test target as part of the Analyze & Run steps in Edit Scheme > Build -> Build.
This is very specific to React Native projects, since this is how the projects are configured by default.
In my case it worked for me to follow the instructions in this article. Then disable Automatically manage signing inside xcode in the general tab.
Automatically manage signing disabled
And finally provide manually Provisioning Profile for Signing (Debug) and Signing (Release)
Note: The Provisioning Profile you must generate it from Apple Developer Program website, in the section Certificates, Identifiers & Profiles -> Provisioning Profiles
I hope you find it useful. regards
Step to be followed
must have a developer account - https://developer.apple.com
create a certificate for development
Add devices with UDID
add provisioning profile in development
sign in Xcode with your account
clean build
Build with any destination choose device I have done for iphone 6
the archive will be disabled first, the archive will be active by choosing
generic ios device from the right corner of Xcode for example ->
yourAppName>generic ios device
once archive is done build for development not ADHOC
done
I fixed it by setting in main Target / Build Settings / Section Signing
Code signing Identity: Debug and Release set to IOS Developer
Code Signing Style: Automatic
Provision Profile: all automatic.
I set this exactly same for Test Target.
Then i was able to run release version on my phone. Btw i dont know what is the difference between IOS Developer and iOS Distriobution though.
I had edited my app scheme Build Configuration from Debug to Release, and unchecked the Debug Executable.
I am not sure why, but if it makes a difference my signing details for Debug and Release were different. So after I reset those back to Debug and checked back the Debug Executable box, and all was fine again.
Edit: found out it was because I was trying to run release mode on my phone via App Store provisioning profile and App Store profile doesn't allow this. I switched to Ad Hoc and there is no more issues.
I guess you already tried this, but I just got the same error, and a quick restart of Xcode worked for me.
Just upgrade to Xcode 8.1. It solves the problem.

Run release build of iOS app on development device

When I build my iPad app for running on my development iPad, it only builds the debug version. I need to see how fast the real release version is; how do I do this? I'm used to Visual Studio's Debug/Release builds, so this Run/Test/Profile/Analyze/Archive stuff isa bit confusing. I see Schemes are related to this but isn't there a simple switch "I want to test Debug/Release version of my app on my device"?
You want to do a release build using an ad-hoc provisioning profile, which will allow you to install it on your device and any others you have specified.
Test flight app is free and can help with this process as well.
In your scheme settings, you can select to build for debug or release. Make sure you have set up code signing correctly. Xcode 5 can help with that.
You can create a new Build Configuration in the Project View under the Xcode Project. Make it a duplicate of Distribution
Then just choose Edit Schemes and choose the new scheme and run on your device. Make sure you the certificates selected in your Build Settings. However you don't get full Debugging capabilities when running a AdHoc/ Distribution build.
This took me a really long time, but I got it working. I usually use automatic signing and it works great. I switched to using FastLane in order to speed up the test flight distribution process and it required that I switch to manual signing. I had to change my release signing certificate to iOS Distribution.
I then had a bug that was only reproducible in release mode, so I needed to run the app on my device in release mode, but it was a pain to keep re-uploading to test flight.
I tried changing my build system to legacy, but that didn't work. I read up on profiles and certificates and I realized that I need to use iOS development certificates to run on device directly (which is what I was doing in debug mode). However, I needed to use iOS distribution certificates to distribute the app. Automatic signing had been taking care of this for me.
I ended up just turning on automatic signing briefly to test my app and then turned it back off and used git to revert the status of the workspace.
TLDR: turn on automatic signing and then turn it back off when done testing

XCode 4.3 code signing errors

Before Xcode 4.3, I used this method to submit applications to the app store:
-- Compile the application with the appropriate signing certificate which was configured inside the application's build settings
-- Distribute the application into the app store or clients using Xcode's built in submission process. When I was asked to select the signing certificate with which to sign the app, I always selected "Don't Resign".
However, the "Don't Resign" option does not exist in Xcode 4.3. Therefore, my application is resigned, and I always end up with an error saying that the code sign verification failed.
Is there any way around this problem?
I have found out that the compilation errors about code signing are due to a bug in Xcode 4.3. As many other have pointed out in Apple's developer forums, and myself, there are many cases where Xcode will complain about code signing your application if your application contains an image bundle! So, I remove the bundle with the images, and re-imported the images as separate files. I was able to compile the application for Ad Hoc this way, whereas it wouldn't compile with the bundle.
Also, as far as "Don't Resign" is concerned, I noticed that even if the application is already code signed in another step, Xcode 4.3 became smart enough to not re-sign the application with the same certificate, even if it appears to not give you the chance to not to! That's what I have verified with Ad Hoc builds. I will soon try that with production builds.
So, Xcode 4.3 became smarter in one way, and dumber into the other. Apple needs to fix this problem with the bundles, SOON!
Yes, there is a way. Before it used to default to whatever code sign it could find and auto-embed it into your apps. Right now its bugged.
To solve it, you would have to go through the steps of obtaining a new certificate and its private/public key. 3 step process:
Make sure you completely delete your old certs and keys by going to Applications > Utilities > Keychain Access. Then Deleting the certificates and private keys associated with your Developer account.
After deleting all that info head Here to generate a new certificate for your app. Download and import to your login keychain
3.In Xcode open your project. Head to your root project folder > targets > build settings and attach the new correct certificates to code sign your app correctly.
If you are unsure about the code-signing process. Either go here or go to the dev provisioning profile under distribution you have some (REALLY OUTDATED) examples to point your way

How do I create a release build in Xcode?

Why is it that when I build an application, Xcode creates a debug build? I want to create a release build. How can I do this?
Product / Scheme / Edit Scheme..
And from the menu that comes up, select Release under "Build Configuration".
Xcode 11
I found this question because I had already finished debugging my app and I wanted to make a release build for the app store. I always forget which menu item to use, though. This answer is a reminder to me and others next time.
Choose the Generic iOS Device from the active scheme menu.
Then go to Product > Archive.
You may have to wait a little while for Xcode to finish archiving your project. After that you will be shown a dialog with your archived project. You can select Distribute app... and follow the prompts.
More Help
This answer is for those who are already all signed up with a developer account and just need to get the archive from Xcode to iTunes Connect. If you need more help signing up for a developer account and getting an app to the app store, read the following links.
How to Submit An App to Apple: From No Account to App Store – Part 1
How to Submit An App to Apple: From No Account to App Store – Part 2
App Distribution Guide (Apple Docs)
Submitting Your App to the Store (Apple Docs)
It is done over building an Archive version.
First connect a iOS device to your Mac. Then select that device as target in Xcode.
Now click on the tab "Product" and click on "Archive"
Leaving the original answer below, but this has not been the recommended method to create a "release" binary for distribution outside of Xcode in a long time — for that you want to Archive: see answers above.
If you are looking to debug/test a Release build in Xcode, this approach is still relevant.
To create a release build, you have to edit your current scheme (⌘<) and highlight "Run [name of application]. On the right, select "Build Configuration" and choose "Release". Build as usual.
If any one needs to go through how to make Adhoc build, here are quick steps
Product > Archive
then
Export > Save for Ad Hoc Deployment ....
See quick video https://jumpshare.com/v/rHLJII2npwyHCgGCabQA
Follow these steps:-
Go to product option
select Scheme option
Edit Scheme option
change Debug to Release
Make sure Through this you can run build in your physical device if you are disconnected to System..
but if you will run the same code o n simulator then you will face some error then that time you need to change the scheme option Release to Debug
Here is my 'more detailed' list of steps for creating a release build > (Working on a team and a project that has many schemes and environments)
checkout a new branch like releases/x.x.x that contains all changes. (x.x.x is the version) (Its more about your team conventions)
Check to make sure your app bundleIdentifier is correct (might differ for each environment)
Team/account/licence: log into correct account that has provisioning profiles. then under signing and capabilities make sure your Team is correctly selected and has all certificates needed
Upgrade the version in project settings to x.x.x
Make sure the scheme you selected is correct
Make sure the URLs of API calls are pointing to your release environment
Its better to select 'Any iOS device' instead of a simulator or actual device
Commit any changes locally if you have any (this step is very important)
Validate to make sure all is good
Create an archive
Distribute your app for AppStore Connect
I use an apple proxy named 'transporter' that is pretty easy for uploading iPA to Appstore
Happy releasing!

Why do I get instruments - "Target failed to run"?

Target failed to run: Remote exception encountered: Faild to get task for pid 3103
I'm running iPhone OS 3.1.3 on the device and I can run my App in debug mode on the device.
I downloaded and installed the xcode_3.2.2_and_iphone_sdk_3.2_final.dmg twice, without any luck.
I got the same issue when I switched to XCode 4 and I solved it by setting my release code-signing profile to my development profile instead of the app store profile that was previously set. Indeed, Xcode 4 profiles your app using the release build by default.
To answer my own question:
I have two applications installed on my device with the same name resp. the same Bundle display name: Doublemill. Since they have different bundle identifiers, the debugger can deal with that, however Instruments seems to be confused.
Hey.
There can also be some other issues.
Provisioning Profile.
From Apple documentation:
For your protection, the instrument does not allow you to process any application that is not
code-signed with your provisioning profile. This includes any copy that has been downloaded from the iTunes App Store.
Device.
Instrumetns UIAutomation doesn't work on iPhone 3G, only 3Gs, 4.
Sadly support for instruments is bad. Apple doesn't seem to put much attention to it.
FYI for those running from the command line and getting the same issue, you have to use the fully qualified path to the application or instruments will blow up (with a relative path). That was a good waste of a couple hours tracking that down.
For those of you having this issues set your "Code Signing Identity" to IOS Developer, see below.
In my case, I using distribute provisioning profile in Release, change to development provisioning profile will fix that.

Resources