iOS Project runs on simulator, physical device, but can't build or archive anymore for "iOS Device" - iphone

To distribute test builds via TestFlight, I select "iOS Device" in the scheme, then click in the menu Product, Archive. This all of a sudden stopped working with the error message:
When I try Product, Build, I get the same message. I restarted my computer, auto-recreated the schemes, checked SDK settings and they look fine to me. I loaded up a different project, and it archived fine. Here are the product and target build settings (they are the same):
My only guess is that a file may have gotten corrupted, because I didn't manually change any of these settings. Just editing code.
EDIT: After I wrote this question, I left my computer for 10 minutes. Upon my return, I tried to build and archive just for the heck of it and it worked. I don't know what to say...
EDIT 2: This is happening again and would like to get to the bottom of this.

After this happening a few times, I figured out the issue. When my iPhone is hooked up to my Mac and tethering is on, this problem occurs. When I turn tethering off, or disconnect the phone, I can archive again. Not sure why this, but I hope it helps someone at some point.

Related

Finished running <App> on iPhone 6.1 Simulator

I'm developing a new application for Iphone, using Xcode (Version 4.6 (4H127)) and the iPhone 6.1 simulator (VersiĆ³n 6.0 (369.2)).
At the beginning everything was great: every time I pressed the "run" button, the application was loaded into the simulator and I was able to test it. But sometimes it is not working: when I press the run button, I only get the message "Finished running on iPhone 6.1 Simulator". The code successfully compiles (only minor warnings).
The main problem is that when I get this message, the only way I can use the simulator again (in this project, the rest of the xcode projects seems to work properly) is by starting a new project and adding every file to it.
I've tried to delete de derived data, restart de simulator, restart de computer, etc. Even I made a snapshot when the simulator was working, but when I go back to the snapshot state, the simulator still don't work.
What can I do? Any idea?
1.Manually launch the iOS Simulator.
2.From the "iOS Simulator" menu, click "Reset content and settings",
3.Close and rebuild your app.
This problem may arise when you have problems with your project's plist's target membership. Select your info plist file from project navigator folder structure's Supporting Files, go to interface builder pane(Utilities Section under View in Top Bar), then look for Target Membership in File Inspector pane, if it is checked, uncheck it. Clean & Build, Hope it helps.
Library > Application Support > iPhone Simulator > 6.1 (or whichever you're using) > Applications > Your Application and delete it.
Rebuild your app and relaunch.
I had the same problem, with the same "failed to attach to process ID 0" (I actually didn't notice that error until I saw that you said you had that error). In one of my projects the 6.0 simulator didn't work, but works in my other projects. Also my 5.1 simulator worked.
What worked for me was based off this other answer for a similar question: https://stackoverflow.com/a/12423912/159758
Go to the Product menu and find the Edit Scheme menu there.
While in Edit Scheme window, select the "Run" option on the left hand side of the screen and then on the right hand side, change the debugger from LLDB to GDB.
Run the project, this worked in the simulator.
Then Go back to the Edit Scheme and set back to LLDB.
I noticed you've tried setting the debugger to GDB and not a debugger, but thought I'd mention what helped me, since you're question helped me get to the bottom of my problem (i.e. seeing the "failed to attach to process ID 0" message).
This problem may arise due to presence of more than one info.plist file.
I also faced a similar problem, and eventually found that while adding some resource file from another project I also added its info.plist file.
Once check your Build phases> Copy Bundle Resources, whether another info.plist file exist there or not. If exists then delete it, clean the project and rebuild it.
Hope it helps.....
I ran into the same issue and somehow was able to fix it and almost immediately it went back to being broken. I can tell what broke it though.
I added a couple of folders (folder references) with files in them to the copy bundle resources section. That broke it. If I recall right, I had removed both of those and was messing around with DeploymentTarget. I might have reset the simulator earlier. Regardless, it started working. So,
there is hope for a fix
this thing is caused by folder resources that need to be copied into the bundle
Updated:
I was able to get it working again. Here is what I did..
- Cleared out the derived data folder
- Shut down the simulator app
- Also cleared the deployment in the simulator folders (Users/XXXXXX/Library/Application Support/iPhone simulator/6.1/Applications)
Since last time adding the folders to the bundle caused it to lock up, I tried it step by step adding one folder to the bundle and trying. Turns out one of my folders was named Resources and it dawned on me that particular name could potentially be colliding with something else the app looks for. So I renamed that folder to Res and tried it. It works now.
So there you have it.. Follow the steps above to get out of the problem.
Avoid copying folders called Resources to your bundle.

Finished Running on iPhone

I am trying to test my app on an iPhone 4S. When I build and run from Xcode, the project is successfully compiled but after that Xcode says:
Finished running MyApp.app on MyiPhone
The app perfectly work on the simulator and the provisioning profile works correctly (I tried to load an empty app and it works).
If I try to manually load the app I get this message:
The Info.plist for application at
/Users/*/Documents/App/AppName/DerivedData/AppName/Build/Products/Release-iphoneos/AppName.app
specifies a CFBundleExecutable of AppName, which does not exist.
Where is the problem?
The connection that XCode creates with the device is rather fragile, and can easily be corrupted if anything goes amiss in the debugging test, most commonly if the developer stops a build, while it is being moved to the device.
I have a routine of things I go through, when this occurs. If one doesn't work, I go further down the list.
Check your signing certificates
: This error can occur if you mess around with the certificates too much. Make sure your current scheme uses the Debug signing when making a debug build, and check in your application settings if the current debug signing certificate is a debug certificate. (Not AppStore, AdHoc or Enterprise).
Reestablish connection with the device
: Look under devices in your Organizer. Check if the device you are using is present and marked with a green bullet. If orange or grey, reconnect the device with the USB. For precaution, wait a couple of seconds from taking the cable out before you insert it. It should make no difference if you eject the cable from your mac, or the part connecting your iDevice.
Reactivate development on the iDevice
: Being unaware why this happends, some devices revert to a non-development stage from time to time. Clicking the "Enable development" under Organizer > Devices seems to clear this off.
Flushing XCode device connections
: Something that often is needed, you can simply shut down XCode (and to be safe, close the iPhone simulator as well) and start it up anew. Deleting the debug application present on the iDevice is also a good idea.
Restart your iDevice
: Tedious as it might seem, restarting your iDevice is sometimes needed, since the pipe held on the device might be corrupted.
Restarting your developer machine
: If everything else fails, a restart of your mac is often required. I have never experienced this error without having it fixed by now.
I hope this checklist will help you through.
Try cleaning the project.
SHIFT+CMD+K
Found the same bug in XCode 9 while running the project on iPhone 5s. Clean the project and it will work.
Clean.
Build.
Run.
It's work for me.
I had similar issue. When I run program on iPad2 it compiles and installs app on device, wait for some time, and display an alert. Then I followed steps below
1) Removed that application from device.
2) Disconnected iPad and tried again.
Then it successfully run in device. If this not resolved your issue, do
Rename your application to some thing else and try to run. It will run. Lastly you can make an "ipa" file with Ad Hod distribution and can test on device.
Looks like you are trying to run a release product on the device. You are probably signing it with production key. Run it as debug.
Maybe I'm totally off with this guess but the last time I got the same message was when I had some required hardware capabilities set in the Info.plist which the target device didn't comply with. (E.g. requiring a camera and trying to run the app on an iPad1.)
I've just finished chasing down a similar problem.
An app that worked on the device (iPad 1) and on the simulator stopped loading on the iPad but continued to function as before on the simulator. When "run" with the device as target, it compiles and then goes immediately to "Finished Running...".
I did all the usual bits - removed the app from the device, ran Product/Clean, removed derived data, shut computer and device down cold, but with no luck. Other development apps loaded and ran fine.
This app uses GameKit. When I removed the gameKit requirement from Info.plist, the app loaded and ran correctly on the device again - including the GameKit functionality (no kidding). When I added gameKit back in, it failed again. When I added the gameKit requirement to other apps, they failed to load to the device as well. It appears that something has happened to the gameKit setting on the device, although gameKit is there and functions as always. I'm suspicious that this one has to do with the state of the sandbox.
I've got to make a few changes to get the app running on the iPhone and I'll test that as well. I'll repost if I sort it out.
Si it seems that XCode build, ran and finished but the app failed to be deployed and was not even copied to the device.
In fact, there should be something in the XCode project that is broken. This is easily corrupted. The best move is to build a new project from scratch. Don't forget to add armv6 support if needed.
It works well for me!
Check the device log
It may occur, that you are using a provisioning profile, which does not allow one of the entitlements, listed for your target.
For example
entitlement 'entitlement-name' has value not permitted by provisioning profile 'Your Profile Name'
For me, the usual culprit is that I have an app store build already on my device.
Different/same version numbers might make things worse. I haven't looked into it too deeply since deleting the version that is already on my device usually fixes the issue.

Xcode 4 not launching application?

Today, after installing Xcode 4 with the 4.3 SDK, I attempted to launch my application. However, the application will build and the iOS Simulator will pop up, but I get a message in the window in Xcode that says "Attaching to YourApp" which stays there indefinitely. How can this problem be fixed?
I had the same problem, that is, when I launched my application in the simulator, Xcode was hung waiting for the simulator to start. The simulator showed a black screen - nothing at all.
Note this is a project that ran fine on Xcode 3 and is the exact set of files used to build the application that is currently for sale at the App Store.
Okay, so here's the underlying problem, and my solution:
My application name was "ultimateTimer.app", as seen in Xcode under the Products folder. However, this was NOT the name in the project file.
Here's how to found out:
Click on your project in Xcode (it's usually at the top, e.g. mine is called ultimateTimer.xcodeproj). Under "Build Settings" tab, look for the "Packaging" area and specifically for the "Product Name" variable. Under Product Name, I had three entries:
Debug
Distribution
Release
Under Debug, it had the value "TalkUltimateTimer" which was an old name of mine. When I changed this to "ultimateTimer" to match the "ultimateTimer.app" as above, I found the Xcode attached to the simulator correctly.
This happened for me for iPhone applications. I opened the simulator myself and switched the device to iPhone Retina Display and from then on it worked. I tried switching back, but it didn't work again, so I have had to keep it on the Retina Display simulator, and if I need to test non-Retina Display I'll use the iPad simulator.
I skimmed the post and these seem to be the two solutions thus far:
I think I figured out the problem:
I went to 'Edit Schemes', and for some reason, the scheme I was using was pointing at BumpDev.app as the executable instead of bumpdev.app. Changing this made things work. Perhaps there is an issue when converting from xc3 proj files?
Anyways, the app now boots in the simulator. Yay!
And the other solution in that post is:
Did your project by any chance have a folder reference with images in it?
For me the problem only happens when I have a folder reference in the project. When I remove the folder reference and instead add the folder as a group, clean the project, and hit launch things work fine. In the "Copy to Bundle" phase each image is then listed individually, whereas when I had a folder reference, the whole folder was listed.
This took me a really long time to figure out. It was quite frustrating, but I'm glad I have a workaround until the bug is fixed.
I had the same problem after swapping the mouse for a new one. restarting my iMac resolved the issue.
I just upgraded to Xcode 4.3.2 and had the same issue with new projects. After poking around and comparing projects, I found out that new projects were set to the LLDB dbugger and the projects that worked were using GDB.
After changing the debugger for the new project to GDB, it worked. I am yet to research what the differences are, but at least I can now run my new projects.
Ensure you are starting a proper scheme.
I. e. when using CocoaPods, running Pods scheme would not start emulator.
It's a known issue. Have a look at this thread in the official forum.
Hey, update Xcode to 4.0.2. Problem solved :)
I had the same problem, I tried every solution here, but no works. Finally, after I rebooted my computer, the problem was gone.
Restarting the simulator worked for me

No provisioned iPhone connected....!

Hii all,
I tried to test my application on the simulator and it fails. Just the day before it was working fine. i checked in the organizer window.. all the provision certificates are installed, but still the color is Orange,. its not working. and when i try to debug the application it shows "No provisioned iPhone connected" error.
I got the same problem before, at that time i changed the name of the folder which specify the iphone version, but unfortunately i don't remember now where that folder is. Can anyone help me please.. or is there any alternative.
Thanks,
Shibin
There are (at least) two possibilities here. As Alex says, if you are trying to run on the Simulator then you need to switch your active SDK to one of the Simulator options. The screen shot is of a rather old version of the SDK but the principle is the same.
If, on the other hand, you are trying to run on a phone that has worked before you usually just need to reboot your handset. Sometimes the process that the debugger connects to gets in a state and doesn't respond. Restarting usually works.
You can the No provisioned device connected error only when you try to test on the device. Did you check the active configuration of your project? In order to run the Simulator you should have the corresponding build configuration selected. See the screenshot: alt text http://img255.imageshack.us/img255/7594/xcodeconfig.png
So you are seeing orange color status of the iphone in organizer? If it is the problem simply switch off your device and switch-on again. Try reconnecting the device. This solves my same problem most of the time.
Hope this helps.

iPhone Device Debugging

Is it possible to actually use the Xcode debugger when running an iPhone app on the device rather than the simulator? i.e., can I have the device stop at breakpoints that I set in my code and step through the code as it runs on the device?
EDIT: I should mention that I am a registered developer with Apple and have a valid certificate. In fact, I can build and run iPhone applications on my device just fine. However, even in Debug mode, my application will not stop on breakpoints or output to the console when I run it on my device. If it helps, my application will function normally in debug mode (e.g., stopping at breakpoints) when I run in the simulator.
EDIT 2: I've tried resetting my phone, completely removing and reinstalling Xcode, creating a new project, changing all the settings mentioned in the answers on this page (as well as others), cleaning and building my project, Build and Debug... If I click Pause, it says "Error from Debugger: Quit". :( Maybe I'll try to debug on this device using Xcode on another computer and see what happens.
EDIT 3: Well, I tried using another computer using a fresh install of Xcode in a new project, and I still can't get device debugging to work. I have a suspicion that it's my iPhone or cable perhaps? I'd like to think that I'm not so incompetent that I've missed something so embarrassingly obvious, but I've double- and triple-checked all of the suggestions mentioned here.
EDIT 4: FINALLY got device debugging to work. I have a feeling that something low-level on my device was causing issues...nothing I did worked on my system. However, I installed Xcode on another system and device debugging on the same device (with the same cable) worked flawlessly. Directly after that, device debugging began working on my original machine, leading me to believe that some strange hardware flag was screwed up and somehow "reset" on the second machine. In any case, it works now... Thanks for all the help. :)
Also, I'm unsure if it's better to leave this question unanswered or pick the most "helpful" answer...
Yes -- just use a device build. You have to get certificates and provision it.
This is a good description:
http://boga.wordpress.com/2008/07/16/debugging-ipod-provision-profilescertificates/
Make sure to start debugging by pressing "Cmd-Y"... and not "Cmd-R" :-)
You may try last trick in case nothing can help.
If your application launched successful on your device from XCode but did not stop at breakpoints - try press "pause" button after start in debug mode. If you will see application paused properly (do not react to user's action) add new breakpoint then press "run" to continue application execution. In some cases it may helps to stop at new breakpoint.
Yes, just set your project to build for the Device.
If you need to setup debugging for jailbroken iPhone (up to 2.2.1) (not pay 99 to Apple yet) follow next steps:
Install MobileInstallationPatch for your iPhone via Cydia (use Search Tab)
Switch off PROVISIONING_PROFILE at XCode: Go to /Developer/Platforms/iPhoneOS.platform/Info.plist, add next keys:
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>
You may also add these keys to any
project particularly at XCode, Project
Build Settings, User-Defined
variables.
Add key to your project Info.plist at XCode
SignerIdentity = Apple iPhone OS Application Signing
Don't forget to install and add to your project settings self-signing certificate from Apple
http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2
"Build and Go", you can connect iPhone and start debugging.
Important! You may need to install and launch at least one legal app (any free one) from App Store first (before "Build and Go" step). Otherwise your application will be successfully installed by XCode to your device but may not be launched. Try this troubleshoot first in case of problem with app launching.
Yes. Debugger and performance tools work fine on the device. That's where I do most of my debugging.
Xcode>preferences>debugging uncheck load symbols lazily
fixed the breakpoints not holding in device problem for me.