How to debug ad hoc version? - iphone

I have an app, it worked well on simulator, but the ad hoc version always crashed when started on my ipod.
Is it possible to debug ad hoc version or its there any replacement solution?
Thanks
interdev

Interdev, try running the debug version on your device; from your description, it seems like there may be some difference between simulator and device, rather than the ad hoc and debug versions.
If that doesn't give you the answer, and it is actually some issue with the ad hoc version, you can always access the crash logs for the device from the Xcode Organizer (Window > Organizer). Good luck!

The suggestions from others to run on debug to find out what the problem is, is good. Beyond this, there are many reasons why apps work on the simulator but not a real device. My top three reasons are:
Case sensitivity. Mac OS 10.x is not case sensitive. iOS is. If you're referencing any files/graphics etc in your project and you have the case wrong, it will work fine on the simulator but die horribly on your device!
Read/write bundle files. On the simulator, you can edit bundle files within your code. On the device, you can't. If your code depends on you being able to do so, again it will work great on the simulator but not the device!
Memory. If there are big memory leaks everywhere your simulator will probably crash as well as your iPhone. But if you're just using lots of memory - perhaps loading in loads of image files into an NSArray - this will work just great in the simulator, but will die a horrible death on the device!
In summary, remember it's a simulator, not an emulator!

instead of building for Ad-Hoc, keep it in DEBUG mode when ran on your device, then try RUN > DEBUG - Breakpoints On

Related

Is it a bad sign that an ipad app runs perfectly on the ipad but not in the simulator?

i've been developing an ipad app for quite some time now, all the previous versions run perfectly on both the simulator and the Ipad, but the newest version which is a major revamp of the app, runs super smooth on the ipad but has a lot of issues on the simulator (images not appearing, etc)
Is this a bad sign? Should i wait to make it work on both before submitting?
Thanks!
I would suggest that you be sure to test it on both versions of iPad and as many OS versions as you can. Be sure that you are running the same OS on both simulator and iPad (As I see in the comments that you say you are). Just to rule out any problems with using code that is incompatable with older OS's.
In general though, if your app is running fine on the hardware you shouldn't have anything to worry about. I would be much more concerned if it was the other way around.
It is almost always bad when an app does something you did not expect or design it to do. If you designed the app to run on both the Simulator and the iPad, and it doesn't run on one, there is possibly something seriously wrong with your design that could do other unknown things during app review, or worse, on many app user's devices (leading to lots of 1-star ratings).
Therefore you should figure out why something is going wrong, and preferably fix it (or at least understand what's happening well enough to determine how it will behave on your customer's iPads).
Some other suggestions:
make sure that both device and simulator are using the same internet connection
uninstall your app from simulator and device, and run clean on your project, and then do a fresh install

Xcode - No provisioned iOS device is connected

I was using Xcode this afternoon and debugging an app on my device just fine. When I got home from the office and plugged in my phone to keep working, XCode would no longer let me debug on my device. The error I received was:
Error Starting Executable. No provisioned iOS device is connected.
So I hopped over to the Organizer, and here is what I saw:
So what gives? Anyone seen this before?
Thanks!
Well I don't know why this helped, but if anyone else sees this thread the thing that "fixed" the problem was to remove the SDK from my machine, restart XCode, then plug in the device. XCode then popped up an alert view asking to collect the debugging symbols from the device, which I allowed it to do. From then on it worked like a charm.
You may be testing your application on simulator and accidentally, device is selected instead of simulator. It help me to sort out this problem.
Make sure you have upgraded to the latest Xcode 3.2.5 with iOSK 4.2.1 SDK.
I had another way of fixing this problem.
I tried upgrading my device to iOS5 Beta 7 ...to test my app in iOS5
Once i finished testing it, wanted to get back to iOS4.3.5 on my device...
it took a little pain but managed to restore it back to the original
but then the debugging didn't work and got the same error as mentioned here.
So i wanted to see what i see in that snapshot that you have : and there it was...
A button called "enable for debugging" if i'm not mistaken.
Worked like a charm.... :)

My app reboots iPhone on 4.1 iOS

I've upgraded my iOS on iPhone 3G to 4.1 and now I run my app on the device.
Firstly, I couldn't install it becouse Xcode was saying I don't have certification etc. (I have jailbroken iPhone). Finally, I succeeded and installed it.
But know something strange happens....
After I had installed my app on the device I run it.
Then, "cocos2d" image appears on the screen and just a second later device switch off! It simply reboots.
What's more - when the device launchs again and I run my app - it works!
I have no idea what's going on. This app works fine on 3.1.3 iOS (even with the same Xcode - 3.2.5)
What should I do?
Do you think the problem is caused by Xcode or iPhone itself?
Maybe reinstalling Xcode may help?
It could be one of two problems.
It could be a problem with your device. Maybe something got sort of wonky with your jailbreak.
Secondly, it could be a problem with your app. Maybe it's crashing. Have you checked your crash logs?

Jailbroken iPhone 3G with iOS 4.2.1 can't be debugged with XCode

I'm trying to debug my applications with XCode 3.2.5 and jailbroken iPhone 3G with iOS 4.2.1.
When I start debug with enabled breakpoints, application can't start (it stucks on 'Default.png' screen) and I get Data Formatters temporarily unavailable, will re-try after a 'continue'. (Can't find dlopen function, so it is not possible to load shared libraries.) message in GDB.
When I start debug without enabled breakpoints, application starts without problems.
I tried to do steps decribed there, but without any results.
When I used iOS 4.1 there was a problem with reboots.
On every connect of the iPhone Organiser displays this message:
**Unknown iOS detected** Xcode does not have debugging information for the version of iOS on the device named “iPhone”. Xcode can collect debugging data from the device to enable development with this version of iOS. This process only needs to be done once per iOS version, and will take several minutes.
Thanks for any help!
It's likely that your problem can be solved by reauthorizing your device:
If your iPhone is plugged into the computer, unplug it
In Xcode, display the Organizer (Window->Organizer)
In the Devices area click on your device and delete it.
Just in case, Quit Xcode and then re-launch it.
Open the Organizer again, then plug your iPhone into your computer.
Tell Xcode that yes, you'd like to authorize the device.
If everything works correctly, Xcode will now download device information for 4.2.1.
If this doesn't work then I suggest performing the steps again, but replace step 4 with removing all traces of Xcode from your computer and then reinstalling it. This includes the entire Developer folder.
The latest Xcode+SDK drop doesn't know about iOS 4.2.1, because it was published before the latest patch came out. Xcode's Organizer has a new feature that tries to download debug support files directly from the device, but apparently it has some (possibly jailbreak-related) issues for some people.
iOS 4.2.1 is similar enough to 4.2 that Xcode can be coerced to use 4.2 support files to debug on 4.2.1 devices. To do this, simply go to the /Developer/Platforms/iPhoneOS.platform/DeviceSupport folder and manually copy the Symbols subfolder and/or the DeveloperDiskImage.* files from 4.2 (8C134) to 4.2.1 (8C148) (or whatever release folder Organizer creates for your device).
Jailbroken 3GS / 4.2.1
I tried Matthew Frederick's recommendation without success. Anyone happened to find a solution to this problem?
EDIT
Please note that I used a jailbroken 3GS and a non-jailbroken 3GS.
Workaround, requires a non-jailbroken iPhone 3GS with 4.2.1 (8C148a):
Delete /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148a)
Connect the non-jailbroken iPhone 3GS with 4.2.1 (8C148a)
Open Xcode and Organizer
Configure the new iPhone for development by clicking the "Use for development" button in the Organizer.
Let it extract the debugging symbols from it recreating /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148a)
Unplug it, remove from Organizer
At this point you can debug your jailbroken iPhone again.
Cheers!
In order to get rid of (Re)Collecting Debug Symbols in Organizer (which in fact does nothing) each time the iPhone is presented to the XCode, a simple workaround is to copy:
DeveloperDiskImage.dmg and DeveloperDiskImage.dmg.signature
from the 4.2 (8C134) to the empty 4.2.1 (8C148) folder.
The XCode will recognize device and you'll be able to debug your code, but without debug symbols for the IOS framework.
But, the gdb console will be alive and you can use it do debug your code (with debug symbols).
Btw. you can always use Simulator for the full IOS support :-)
My completely non-Jailbroken iPhone does this with 4.2.1, and gets exactly the same messages and problems. It's new functionality in the latest version of XCode, so it may well be buggy.
Additional suggestion besides Fnord's suggestion is to make sure that multitasking, or the "Reenable Functionality" in PwnageTool is not enabled for iPhone 3G jailbroken device.
I'm not sure if this has an effect though. But, it's reasonable to do this if we really want to test it on a real world condition of iPhone 3G.

app crashing on device

the app I've installed on an iPhone 3G device periodically crashes. I'm wondering if it's the device or the code. the code works fine on the simulator.
I have other apps from the app store that do the same thing. e.g. the stackoverflow app - whenever I do a search the app crashes. I've even had the iPod app crash too.
I've restored the phone a few times and still the same thing. I'm getting ready to upload the app to the app store and was wondering if anyone had any tips to make sure that my code is not the problem. it's difficult to tell because there are no errors in the simulator or memory leaks in Instruments
thanks in advance.
You can be guaranteed that it is your code. Run it in the debugger on the device and see where it is crashing. If you are getting EXC_BAD_ACCESS use the following to help track it down
http://www.cocoadev.com/index.pl?NSZombieEnabled
It most certainly is your code that crashes.
Run in debug mode and watch the console (real debug mode, not only the debug target).
Also, you can (and should) grab the crash report from the organizer. You can also watch the device's console there.
Are you sure you are not running out of memory?
the easiest way to see if this is your problem is to implement didReceiveMemoryWarning method of your controllers and check if they are called.
In the simulator you can simulate a memory warning but I am not sure if even in simulator app will crash if memory is not released. (I believe not)
Also run your app with instruments, using allocations: Run > Run with performance tools > Allocations.
And use your app for a while and you will see. ;)