Run on device gets "Finish running on device" message but never runs - iphone

I'm trying to run for the first time an app in a device.
XCode 4.2
iPhone 3G 4.2.1
I have a provisioning profile showing under Xcode organizer installed with a wildcard app identifier (DQQVZJ94G3.*).
The device lists in XCode organizer.
I have certificates installed in my Mac keychain and they show the private key.
I have created a new project from template and didn't add a single line of code.
I have set iPhone as my schema.
I have set under Build Settings->Code Signing->Code Signing Identity->Debug->Any iOs SDK-> the iOS Development Certificate/Provisioning Profile pair.
I have set the tagert deployment target as 4.1.
I have set Bulid Settings->Architectures to Standard(armv6)
I have removed from plist file "required devices capabilities"->armv7
All the previous settings are set up in the Target settings.
I have realunch xCode and reinstalled certificates and profiles.
Whenever I hit Run, I just get "Finish running myApp on iPhone", but nothing happens, not even a log to get a cue of what's happening.

Build settings are duplicated: there are project build settings and target build settings. Generally, if you change the project settings, the target settings are automatically changed, and this is useful if the project contains multiple targets. But sometimes, that doesn't work and you have the manually change the target settings which are the actual settings used to build the target. So start with that and verify that the target settings look like this:
Architectures : $(VALID_ARCHS)
Valid Architectures: armv6 armv7 (default value)
iOS Deployment target : iOS 4.2.1 or lower
If that doesn't work, then the problem is probably that the provisioning profile isn't correctly setup. An easy way to make sure it works correctly is to make Xcode manage it for you. So remove the provision profile from your device and from Organizer, also remove the developer profile from Organizer. Then plug the iPhone, right click on it in Organizer and select: Add Device to Provisioning Portal.
Edit
Make sure you remove the other values in Architectures. For example, in the screenshot below, you have to remove the selected line armv7.

I added armv6 as described in the other answer, then under Target, I had to remove "armv7" from "Required device capabilities"

I had the same problem and my solution ended up being that I didn't have my iPad's device ID added to my devices list.

Related

How to test the release build on device with Xcode 4.2?

I've just finished writing an update for my app, and now I want to submit it to the app store.
I've thoroughly tested it in debug mode on multiple devices, but I want to test it with the release build just to make sure nothing screws up.
In Xcode 4.0.2, when I wanted to test the release build (i.e. not distribute), I would just do the following
In the project settings, make sure that the release code signing is set to "iPhone Developer" not "iPhone Distribution"
Go to Edit scheme..., and change the Run scheme to Release instead of Debug.
Make sure my distribution provisioning profile is installed in Xcode
Run it on the device, make sure everything works.
If it all works, I would then distribute with the following:
Change the code signing to "iPhone Distribution"
Make sure the Archive scheme is set to Release
Archive
Submit
Now the problem is, with Xcode 4.2, I can't test the release build on my device. - When I build it with release to my iPod, I get an alert:
A valid provisioning profile for this executable was not found.
So, I checked my provisioning profiles under the main "Library" section of the Devices pane (all provisioning profiles), and I found my distribution profile there.
The problem is, the provisioning profile says "This profile cannot be installed on deivces".
So, if I can't use the distribution profile with a device - how am I supposed to test the release build?
I would appreciate any advice with this issue - sorry if there's something obvious I'm missing!
Ref: https://developer.apple.com/legacy/library/technotes/tn2250/_index.html#//apple_ref/doc/uid/DTS40009933
How do I confirm my Provisioning Profile is for App Store distribution?
You can confirm whether your provisioning profile is an App Store Distribution profile within the Xcode Organizer > Devices tab > Provisioning Profiles section under "Library"; single-click to select the particular provisioning profile and in the Header Pane, the "Devices" text will read "This profile cannot be installed on devices" if it is an App Store Provisioning Profile.
That means you would need to create another distribution profile for testing.

iOS device is not listed in Xcode

I have done the provisional profile and it is showing properly in Organizer. Iphone device is also listed and next to it is a green little circle.
However, in xcode the device is not listed and can not be picked.
What can be the issue.
Have you click on "use for development" in organizer?
Click on your top project item, and check the Summary tab on your target.
Under Devices if you have selected iPad then it won't let you build to your iPhone.
Also, if the deployment target is higher than the version on your device it might not work.
Have you tried the following?
Restart Xcode
Restart the iOS Device
Restart your computer
I had the same issue and following worked for me in XCode 6.1
1: Open Devices (Window>Devices)
2: Select Device
3: Go to settings and Mark 'Show in Run Destination Menu'
There are a couple of issues that could be causing this.
1. Incorrect provisioning - Verify that you have specified the correct provisioning profile in "debug" in the build settings for both the project AND the target. Then make sure that that same provisioning profile has that device authorized on it (Apple Provisioning Portal) and that the profile has been installed on the device.
2. Proper deployment target value
3. Device Type - Make sure that your project is set for the correct device type (iPhone or iPad or Universal).
4. Restart Everything
I had the same exact issue. My problem was that I had accidentally installed the same provisioning profile twice. So when I clicked "Provisioning Profiles" (from the drop-down tree in Organizer below my device) it listed 2 instances of it -- one where the Team field showed my name and one where the Team field listed "Unknown". I deleted the "Unknown" instance and my device immediately showed up in my available devices list for testing.
For me, it was a simple case of having the deployment target set too high. I started the project on Xcode 7.3.1 on my work machine... but when I got home, I opened up the project with Xcode 7.2 (which does not have the 9.3 SDK). After changing it to the proper deployment target, voila... good to go.
And by simple, I mean I restarted, cleaned and screwed around with it for about 20 minutes before I smacked my head and saw the problem. :-)
For VMware Users
Goto menu VM->Settings->USB Controller->Change USB Compatibility 3.0 to 2.0 and then Check show all usb devices.
This worked for me. Now xcode is showing connected iphone device.
If show all usb devices option is disabled, power off virtual machine and try.

xcode cannot find the software image to install this version

I'm new to xCode development and struggling my way through the provisioning system trying to run a Hello World app on a real device. I went through al steps and everything seems fine but one thing:
When i click my device (Iphone 3G running IOS 4.2.1) in the xCode organizer the following message is displayed under Software Version: Xcode cannot find the software image to install this version...
Also the provisioning profiles show no status in the organizer (both in the library and on the device). On the provisioning portal they have the status active.
I hope someone can help me, thanks!!
ps. i am working with xcode 4
Update: OK, I've found the solution -> set deployment target to 4.2 in info tab: https://discussions.apple.com/thread/2780316?start=0&tstar
The message "xcode cannot find the software image to install this version" seen in the organiser window... This is just a notification rather than a problematic error.
If you want to eliminate this message anyway, I found I was able to do this by running restore within iTunes. Part of that process involves downloading some stuff, which I presume is the 'software image'.
But, as explained in Technical Q&A QA1569 "This message does not prevent you from using the device for development purposes. The only effect is the inability to reinstall the OS currently on the device using Xcode." ...and that has been my experience. Back in the main Xcode window you're still able to click 'run' and send the app to the device to run.
...and it will run assuming everything else is set-up OK, but there are various other gotchas related to Xcode 4.2 and v4 devices:
As mentioned by Overbeeke you should ensure the 'deployment target'
of your project is set down to the desired version (the minimum
version of the devices you want to support) Additionally I would
point out that the 'SDK version' should normally remain set to the
latest (it's whatever SDK Xcode on your machine is using)
As mentioned by Kenneth Lam, in the new Xcode you need to frig around
with "armv6/armv7" settings if you want to support earlier models of
iPhone. Follow these instructions to add the right "Architecture" armv6 setting. Additionally I would point out (as per this answer further down) that there is a setting called "Required device capabilities" from which you need to remove 'armv7'. This is in your app's plist file.
I'm saying all this like I'm an expert, but I still can't get it to work on a v3.1.3 device :-)
I think Xcode 4 requires that you are running the latest iOS to use that feature, but you don't need it to install apps on a device. I have run my apps on an iPod Touch 1G (which can't be upgraded to iOS 4.3) with the same iOS as you and it worked.
Have you added your device to the provisioning profile?
What I did is opened the organizer, right click on the device on the left pane and select "Add device to provisioning profile" where you will be asked for your Apple ID (within xcode) and it will add the device to your profile without you leaving xcode, much simpler than using the online portal.
Xcode 4.2 only builds armv7 targets by default. (Iphone 3G running IOS 4.2.1 is armv6) Add armv6 build targets by following these excellent instructions from Nick "Warning: iPhone apps should include an armv6 architecture" even with build config set
just an update, to update the iOS deployment target, click your project in the left pane, the one with the blue 'A' icon. click the build settings tab (not info), instead of showing "basic," show "all." iOS deployment target is in the deployment section.
There could be a number of things, but i would make sure that that your deployment taget in build settings is at or below your target . Check the "deployment section" in the build settings of your project. The default sets the deployment to the highest iOS version, if the ios version is below what is set you will not be able to run the app on that device.

Steps to test iphone app on device (profile/certificate already created)

I want to test my app on my itouch which has ios 4.2.1 .
I have completed the steps for provisioning profile/certificate. So under Organizer,
when I select my device, I am seeing the provisioning profile
and under Developer profile, I see 2 entries; iPhone Developer and iPhone Distributor
Now I want to just test the app on my device (NOT looking for steps to submit the app for distribution at this stage)
I think there are some Project settings that I need to do under XCode. But I am unable to figure it out. Please provide me the steps to test on device.
My XCode ver is 3.2.5
I was hitting an issue following this and the documentation where my app would not deploy to my iPhone 3G running iOS 4.2.1 using XCode 4.2. I hope this helps others who end up on this question trying to get their apps to deploy to a real device through XCode.
I kept fiddling with the Base SDK setting along with the Deployment Target setting in the project and target settings area. However, I had them correct to start with so that wasn't the answer (I want to target iOS 3.2+, so I kept all set to that). In addition, I messed with the provisioning profiles, certificates, etc. multiple times even though they looked right to me. They weren't the issue, either.
The key was changing the architecture settings that are scattered throughout the interface.
First, since I am testing it on an iPhone 3G, I needed to support the armv6 architecture as well as armv7 for later models. So I added "armv6" to the "Valid Architectures" entry on the project's "Build Settings" tab.
Next, I made sure it was showing "armv6 armv7" under "Architectures" in the "Build Settings" tab of the target for my project.
Finally, I clicked on the -Info.plist file for my project and removed the "armv7" entry for the "Required device capabilities" that is put there by default for new projects in XCode 4.2.
After this, my app ran successfully on the device using Command + R for Run.
Double click your app under targets in Xcode
Make sure that for the configuration 'Development' you have the right development provisioning
profiles selected.
click on the properties tag and make sure that the identifier is the same as the identifier used in
the development profile.
clean all targets, in Xcode make sure you are building for Device, Debug, and than click 'build and run'.
If the development profile is on your iPhone and you have installed it into Xcode correctly it should work. However sometimes after installing a profile on your iPhone it doesn't register everywhere it needs to and I have found that this is fixed by restarting the iPhone (not Xcode).
Good luck.

Xcode 'CodeSign error: code signing is required'

I've been working on an iPhone project with iOS 4.0. I just downloaded Xcode 3.2.4 with iOS SDK 4.1 so that I can work with the updated iOS. Upon opening the project in the udpated Xcode, I found that the target read 'Base SDK Missing'. I fixed that by following the instructions here.
Now when I try building targeting any version of iOS, I receive this error (with the corresponding version referenced in the error text):
CodeSign Error: code signing is required for product type 'Application' in SDK 'Device - iOS 4.1'
I have the Team Provisioning Profile created by Xcode installed, that Provisioning Profile has my certificate, and the Code Signing Entity selected is 'iPhone Developer: Aaron Milam'.
Any ideas as to what I could be missing here?
It happens when Xcode doesn't recognize your certificate.
It's just a pain in the ass to solve it, there are a lot of possibilities to help you.
But the first thing you should try is removing in the "Window" tab => Organizer, the provisioning that is in your device. Then re-add them (download them again on the apple website). And try to compile again.
By the way, did you check in the Project Info Window the "code signing identity" ?
Good Luck.
Be sure you code sign on the line "any iOS SDK" and not "Debug/Distribution/Release"
Here is exactly what I did :
Code signing identity -> don't code sign
* Debug -> don't code sign
** any iOS SDK -> [my developer profile]
* Distribution -> don't code sign
** any iOS SDK -> [my AppStore profile]
* Release -> don't code sign
** any iOS SDK -> [my AdHoc profile]
When I put my profiles one level above (at Debug/Ditribution/Release), it doesn't work for some reason (bug ?).
Hope it helps some of us !
I love Stack Overflow:
I realized that some time being too specific is not enough that is because we may have different Xcode version, I have 2 xcode version on the same Mac Pro myself. So here I would like to provide a general instruction that i hope it will work for all Xcode version:
My 2 versions are xcode 3.2.6 and 4.0. You need to find (even google for the settings) your xcode BUILD SETTINGS and its CODE SIGNING under CODE SIGNING you have CODE SIGN IDENTITY this provide you a list of IDENTIFIERS (if you do not have IDENTIFIERS go here to get one and registration is required https://developer.apple.com/ios/manage/overview/index.action - follow this instruction of Apple "Get your application on an iOS with the Development Provisioning Assistant") If you have a list of identifiers just select a valid one and run your Xcode again. It will work!
3.2.6 specific: On your scode window - click on Project -> Project settings -> Build (tab) -> there is a scroll down because the list is long MAKING SURE you scroll down to find your CODE SIGNING section
4.0 specific: On your xcode window - click on your project file left most colum -> then next colum click on your target app -> find CODE SIGNING and assign an IDENTIFIER. It should work for you.
Done!
Most common cause, considering that all certificates are installed properly is not specifying the Code Signing Identity in the Active Target settings along with the Project settings. Change these from to iPhone Developer (Xcode will select the right profile depending on App ID match).
In Xcode , change from Simulator to Device (in the dropdown at the top of the Xcode window), so that your target for application deployment will be the Device.
The default ID which is a wild card ID is like a catch all iD, when associated in Code Signing (if you are using sample files to build, they will most obviously not have com.coolapps.appfile imports, in which case without the 'Team Provisioning profile', your build would fail. So you would want to set this in your
Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select 'iPhone Developer' as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )
and also (VERY IMPORTANT)
Xcode->Project ->Edit Active Target ->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select 'iPhone Developer' as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )
Complete steps for a beginner at:
http://codevelle.wordpress.com/2010/12/21/moving-from-ios-simulator-to-the-ios-device-smoothly-without-code-sign-error/
Make sure that you have created provisioning profiles correctly..
if you did.. you must be having ... public key, private key and Certificate in Keychain Access.
CHECK if you have all these..
XCode 3.2.4 Comes with the Auto device provisioning ... so you just have to sign in to your developers
account it will download all valid profiles..
If you have all you need in keychain and downloaded profiles...
When you are selecting iPhone Developer: Aaron Milam'. in build settings..
make sure you have selected Configuration ( on left top inside Target->Build ) you want to make build for.
or you can do All configuration to make changes in all available configurations i.e. Debug, Release etc.
Summarised form an answer to Xcode fails with "Code Signing" Error
project.pbxproj files can be merged in such a way that two CODE_SIGN_IDENTITY lines can be inserted. Deleting one of these normally fixes the issue.
I have created simple script to help diagnose this issue it can be found here: https://gist.github.com/4339226
A full answer can be found here.
After trying all of the above answers, and everything else I could think of from within Xcode 4.6, I fixed this with these steps:
Close Xcode
Right-click on .xcodeproj file -> show package contents
Edit project.xcodeproj in a text editor
Search for "CODE_SIGN_IDENTITY" - there will be pairs of lines like this:
CODE_SIGN_IDENTITY = "iPhone Developer: Joe Smith (555NN555)";
"CODE_SIGN_IDENTY[sdk=iphoneos*]" = "iPhone Developer: Joe Smith (555NN555)";
I found 2 targets with value like that, and 2 targets with
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTY[sdk=iphoneos*]" = "";
I copied the former pair of lines over the latter pair of lines for all cases where the latter pair was emtpy.
I then restarted Xcode, and it works fine now.
As already mentioned here if you don't want to code sign you application you can
set CODE_SIGNING_REQUIRED to NO. Here is method to do it without any project/files
modification:
Create file NoCodeSign.xcconfig:
CODE_SIGNING_REQUIRED = NO
Set XCODE_XCCONFIG_FILE environment variable to path to this file:
export XCODE_CXCONFIG_FILE=/path/to/NoCodeSign.xcconfig
Now you can build your application without code signing.
Toolchain for CMake users
In my case, locking and unlocking login-keychain from Keychain Access did the trick
Populate "Code Signing" in both "Project" and "Targets" section
Select valid entries in "Code Signing Identity" in both "Debug" and "Release"
Under "Debug" select you Developer certificate
Under "Release" select your Distributor certificate
Following these 4 steps always solves my issues.
Another possibility - When you Build for Archive make sure your Archive choice in your scheme is set for Distribution, not Release.
Go to Product -> Edit Scheme This brings up a new dialog.
Select Archive on the left. Make sure the build configuration is Distribution.
In file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist
change the CODE_SIGNING_REQUIRED YES
to
CODE_SIGNING_REQUIRED NO
Restart Xcode
Have you updated the firmware version of the iPhone you are testing on?
I use Xcode 4.3.2, and my problem was that in there where a folder inside another folder with the same name, e.g myFolder/myFolder/.
The solution was to change the second folder's name e.g myFolder/_myFolder and the problem was solved.
I hope this can help some one.
Maybe your mac's date and time are incorrect. Just correct them.