How to debug with iPhone? - iphone

I have an iPhone and necessary certificates also, but don't know how to debug an application using xCode to iPhone.
I have all these. I have Mac Mini and iPhone 3g, but I don't know how to use all these certificates. I want to debug an application - having shake handling code. That I can't debug on simulator. So I just want to print x,y & z (nslog) while I am shaking phone. This means it's only possible when I am debugging with iPhone.

Login to iPhone Developer connection. Go to: http://developer.apple.com/iphone/manage/overview/index.action
Then follow on the right tab make sure you:
Register your phone under "Devices"
Register the name of your app under "APP IDs"
Download an app prov profile under "Provisioning" to a local folder
Install the provisioning profile on the device, through:
Drag and Drop to iTunes and Sync your iPhone
Drag and drop to XCode menu->Window ->Organizer -> Provisioning
Confirm that the provisioning profile is in the list.
Choose the Active SDK for the Debug (Tab Located just below the close,minimize buttons of window) select: Device - 3.1.2(or other SDK build you have).
Then hit Xcode Menu -> Run -> Debugger -> Build and Go (Click Console icon which is another helpful tool)
This should:
Install the provisioning profile on the phone. Confirm by checking(on the iPhone) Settings -> General -> Profiles -> NameofProvisioningProfile
Install and Run the app.

Related

App cannot run on real iOS device but can run on the simulator

Previously, my app works fine on my iPad, However, yesterday Xcode started giving me this error as shown in the screenshot.
Does anyone know how to fix this? Please help me, thanks.
you need to create a provisioning profile in developer.apple.com if you dont have one yet.
then add the device to this provisioning profile by:
Login to your developer portal through developer.apple.com
Add the UDID in devices (you can retrieve it from Itunes from your
mac)
Go back to XCode, open up the Organizer and select
"Provisioning Profiles", ensure that "Automatic Device Provisioning"
is checked on the top right pane, then click on the "Refresh"
button, and magically all your devices set in the provisioning
portal will be automatically added.
After doing these steps try again run your app it should work

How to test iOS app on device with USB cable

I created the certificate and provisioning profile, but I cannot figure out how to get the app onto the device. I have an iphone connected to the computer and don't know what my next step is.
Go to xCode and choose:
Window -> Organizer
In this window you will be able to find your device.
Click your device and press "Use for development" :-)
open xcode now go Window ->Organizer copy attached device identifier(UIID) like as (3133a6e14322a59b4f4d762fa0fcc0f7efe0lb24).
Goto https://developer.apple.com/account/overview.action
Choose Device add new device(click + sign) give device name and past device identifier.
Now go to provisional profile.
Edit provisional profile for both development and distribution. check new added device.
Again go to Window -> Organizer->provisional profiles delete all and refresh it(clicking refresh button on right bottom).
New downloaded profiles appears with green dot.
Next open your project goto Build Setting->code signing identity choose your provisional for iPhone development or distribution.
Hope it works.

Submitting app to Apple App Store (iPhone)

I wrote my app and it compiles. I have successfully tested it on my iPhone and in the simulator. So now I want to submit it to App World. I downloaded the Distribution Certificate, and (when Xcode 4.2.1 was minimized) dragged the certificate onto the Xcode dock icon.
When I go to Product -> Archive, it says "Build Succeeded" and gives me the Organizer window. I click "Submit" and sign into iTunes Connect, select my application, but when I go to select the Identity it says "iPhone Distribution (does not match any valid identity/profile pairs)". I configured my app on iTunes Connect (it says "Waiting For Upload").
What am I doing wrong?
You should create a distribution provisioning profile using the Provisioning Profile management site, which you can find at the Apple Development Program portal. After having created this profile, you should open it up with XCode, then open your project and open it's properties (where you set the Icon and stuff) and select the tab "Build Settings". Click "all" and "combined" and then search for Code Signing. Expand it and set your Code Signing Identity (and of course Release and Release => Any iOS SDK) to iPhone Distribution. If all goes good, you should compile the project without any warnings or errors.
Now try uploading your app again, as you have imported your Distribution profile, you should now successfully be able to upload it.

how do I transfer my iPhone application to my real iPhone?

I am a registered iOS developer. How do I get my iPhone application transferred to my personal iPhone?
For testing? Just select your device instead of the simulator.
You use Build and Archive in Xcode to create an ipa file that you can drag into iTunes. The chosen answer to this question explains it with a screenshot.
Follow Apple's guide here:
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/128-Managing_Devices_and_Digital_Identities/devices_and_identities.html
For ios7 and Xcode 5 and for testing it, follow the below steps:
You need to request a certificate (if this is your first time)
Connect you iPhone to your Mac and then click on "Development in Xcode's Organizer window"
Sign in with the Apple ID associated with your iOS Developer Program membership and Xcode will automatically generate your certificates.
in Xcode, Click on "Product" -->"Destination" --> you should see the name of your iPhone list there so click on it :)
in Xcode ,Click "Product" --> "Build for Running" --> "Allow"
in Xcode ,Click "Product --> "Run" --> "Allow"
source
After you login into iOS Dev Center, you will be able to reach the iOS Provisioning Portal.
There, you will have all procedures and step-by-step guides on how to create your development certificate, register your device, create a mobile provisioning, etc.
https://developer.apple.com/ios/manage/overview/index.action

Adding devices to team provisioning profile

I need to add a device to my team provisioning profile, however I do not physically have the device so I can't hook it up to my computer so Xcode can't add the UDID to my devices and to the team provisioning profile. Is there a way to add it manually to the team provisioning profile, I can't figure out how to edit it. Also when I add the device in my provisioning portal it doesn't get added to my team provisioning profile automatically.
This worked for me:
Login to your iPhone provisioning portal through https://developer.apple.com
Add the UDID in devices
Go back to Xcode, open up the Organizer and select "Provisioning Profiles", ensure that "Automatic Device Provisioning" is checked on the top right pane, then click on the "Refresh" button, and magically all your devices set in the provisioning portal will be automatically added.
right click on the device, then select 'add device to provisioning profile'
For Xcode 6 it is a little different.
After adding the device UDID in the developer site (https://developer.apple.com/account/ios/device/deviceList.action), go back to Xcode.
Xcode -> Preferences -> Accounts
Select the Apple ID you added the device under and in the bottom right, click "View Details..."
Hit the refresh icon on the bottom left and then try to run the app again.
Per May 16th 2013, using XCode 4.6.2, I had to do the following to add a device (which I do not have physical access to) to the team provisioning profile:
Login to the provisioning portal through developer.apple.com
Add the UDID in Devices
Select the Team Provisioning profile in Provisioning Profiles
Click the Edit button
And under devices for that provisioning profile, click Select All, or just the devices you want included.
Click Generate
Then go back to XCode and click refresh icon (bottom right) under Organizer -> Devices -> Provisioning Profiles
Sometimes it takes a while before the certificate is updated and fetched from XCode.
Hope this helps new readers.
I faced multiple time the same issue that I add device info to portal so I can publish build to fabric testing but device is still missing due to how Xcode is not updating team provisioning profile.
So based on other answers and my own experience, the best and quickest way is to remove all Provisioning profiles manually by command line while automatic signing will download them again with updated devices.
If this can lead to some unknown issues I don't know and highly doubt, but it works for me just fine.
So just:
cd ~/Library/MobileDevice/Provisioning\ Profiles/
rm *
And try again...
Workaround for adding a device to an existing (automatically or manually created) provisioning profile (tested in Xcode 8.2.1):
Add the device in the developer portal.
Only when using a manually created profile: add the device to the profile.
In Xcode, go to Xcode > Preferences > "Accounts" tab > select your Apple ID (left pane) > double click on your Team Name.
Locate the existing provisioning profile. (automatically created profiles will begin with 'iOS Team Provisioning Profile' or 'XC iOS' or similar.
Right click on the profile.
Choose 'Move to Trash'.
The profile will disappear. A new profile with the same name might appear again, that is OK.
Xcode should now be aware of the newly added device.
Get the UDID from iTunes:
http://www.innerfence.com/howto/find-iphone-unique-device-identifier-udid
Once you have that:
Login to your iphone provisioning portal through developer.apple.com
Add the UDID in devices.
Add the device to the provisioning profile.
Download the profile again and enjoy.
There are two types of provisioning profiles.
development and
distribution
When app is live on app store then distribution profiles works and do not need any devices to be added.
Only development profiles need to add devices.In order to do so these are the steps-
Login to developer.apple.com member centre.
Go to Certificates, Identifiers & Profiles.
Get UDID of your device and add it in the devices.
Select a developer provisioning profile and edit it.
Click on check box next to the device you just added.
Generate and download the profile.
Double click on it to install it.
Connect your device and retry.
This worked for me hope it works for you.
Note that testers are no longer added via UUID in the new Apple TestFlight.
Test Flight builds now require an App Store Distribution Provisioning Profile. The portal does not allow UUIDs to be added to this type of provisioning profile.
Instead, add "Internal Testers" via iTunes Connect:
Internal testers are iTunes Connect users with the Admin or Technical role. They can be added in Users and Roles.
After adding a user, be sure to click on their name and flip the "Internal Tester" switch.
Then, go to App > Prerelease > Internal Testers and invite them to the build.
Login to your iPhone provisioning portal through developer.apple.com
Add the UDID in devices
Go to Provisioning Profile sections. Click on your provisioning profile, click on Edit.
In Device section select your added device and generate provisioning certificate again.
Download it and double click. It will automatically added in your Xcode.
To check UDID present in .ipa file or not. Generate .ipa file and upload on diawi.com, get diawi link and hit on Safari browser. You can check their how many UDID are integrated in generated .ipa.
After you've added the UDID to the devices in Provisioning Portal manually, you should trick Xcode into generating a new Team Provisioning Profile (with the newly added device included). Follow these steps:
Open Organizer > Devices > Library > Provisioning Profiles. Find the existing (old) profile (that does not include the newly added device). Delete it.
Connect one of your own devices. Right-click on it in Organizer > Devices > Devices. Choose 'Add Device to Provisioning Portal'.
This will trick Xcode into generating a new Team Provisioning Profile, which automatically includes devices you've added in Provisioning Portal.
If you have recently created new provisioning profiles, you will have to disconnect your phone, close XCode. Then open XCode, refresh your accounts then build and deploy at least once to your phone.
After adding UDID in developer.apple.com, do the following steps:
1, Go to Xcode, open Preferences (cmd + ,) -> Accounts -> Click your Apple ID -> View Details
2, In the new window, click on "Refresh", then "Request"
3, Now try to run your app on the new device, if you get an error saying "unfound provisioning profile", keep reading
4, Click on your project
6, Find "Fix It" button in Identity section, click it
7, Now try to run again, it should work
Update for Xcode (Version 9.1). Please follow below steps for refreshing Provisioning profiles
Using Xcode Organizer
Select Export
Select desired distribution facility
Now Select Automatically Manage Signing Identity
In next Screen Please click on Profile tag detail discloser button which will navigate you to Provisioning profile Folder
Select all profiles and trash them. Now in Xcode click on the Previous button and click again on Automatically Manage Signing, Now Xcode will create new signing identity for you with latest features (including new device id's)
In short, you can navigate to MobileDevice/Provisioning Profiles/ folder path and delete all profiles and then Archive. Now you can see there are new profiles for you. Cheers :)
#JasonH hope it will help you.
Now for Xcode 12.5
You need to create a new Apple Distribution Certificates
Go to Xcode Preference
Click Account, choose your Team you want to update
Click Manage Certificates
Click + Apple Distribution Certificates
Go to Keychain and delete the old certificate
This is what worked for me in XCode 7.3
Login to developer.apple.com
Add the device.
Head straight back to XCode (DO NOTHING) and create the .ipa
Install the build on the device, it will work.
I have no idea how this worked since I didn't download a new provisioning profile which included the newly added device, neither did I touch anything in XCode after adding the new device. That's Apple magic for you.
I will try to add an explanation to this if I find one.
As of Sept 2018, Apple seems to (or a bug) block the normal way to get your XS and XS Max's UDID. Even XCode could not properly register new phones for you.
After a couple hours of digging, I figure it out:
Connect your iPhone to your Mac.
Navigate to  -> About This Mac.
Click on System Report and select USB.
Click on iPhone, and copy the value next to the Serial Number label.
Copy and paste the value. You then need to add a – after the 8th digit.
This is the UDID for the iPhone XS and iPhone XS Max.
Source
All answers I've seen above assumed that the developer owns an iPhone. No one knows the right answer. As far as I know, you need:
a physical iPhone that you own
or UDID of someone else's iPhone.
But it is a must to have an iPhone before you publish your app. Correct me if I am wrong.
login to developer account of apple and open the provision profile that you have selected in settings and add the device . The device will automatically displayed if connected to PC.
Xcode 10.3
In finder navigate to: MobileDevice/Provisioning Profiles/
and delete all files there.
Then Archive and Automatically manage singing.
You are done!