I'm debugging an iPhone application and, well, gdb is just not doing it for me.
Are there any alternative debuggers or debugger uis I can use for XCode in general, or specifically for debugging iPhone applications?
lldb is the only supported alternative. Last time I checked it was in alpha state.
Life was better for Apple developers when we had a choice of IDE's (CodeWarrior, Think__, MPW, etc.) and debuggers (anybody remember Jasiks?), but anyways... consider this a business opportunity (to write a better debugger).
Not sure if you care to know this fact, since I have a feeling you're just not too thrilled with Xcode's built in debugging capabilities, but you CAN change the debugger between GDB and LLDB very easily. Look at the "To change the debugger..." section of Apple's Debugging & Analyzing Your Code document (right at the top, within the first screen of text).
Related
I checked all the other variants of this, and don't see the answer here. It seems a lot of folks are thinking of Xcode 4.1, and the issues therein.
First of all, I am very happy with Xcode 4.2. It fixes the huge plethora of problems I was having, and, once again, makes the simulator a useful tool. I am very glad for this, because it is a MUCH faster workflow than using the devices.
Now, 4.2 introduces something in their Edit Scheme dialog (Go to the "Run" page, then "Options"). This is called "Core Location [checkbox] Allow Location Simulation". It allows you to pick from a list of pre-defined locations.
This seems to obviate the horrendous hack that I had introduced when I first encountered the issue in Lion.
However, it no workee. I'd like to find out what I am doing wrong. Has anyone gotten this working?
Remember: THIS BEGINS IN 4.2, WHICH JUST CAME OUT YESTERDAY. So the rules from 4.0 and 4.1 don't apply. It is a new capability.
Thanks!
First, I created the GPX file as mentioned in this question.
In addition to updating the Run Scheme to select the Allow Location Simulation option and specifying the Default Location as you mentioned, you also need to make sure that your Scheme is set to iPhone 5.0 Simulator. This made the trick for me, when I debug my project, the app asks me if I want to allow it to use my current location, and I can see the Debug -> Location menu in the iPhone Simulator.
There's a thread on this bug in the Apple developer forums. One suggestion is to reset the simulator.
When an iPhone or iPad app throws an error, what is the recommended way to get the data reported using Monotouch?
I simply use the Console.WriteLine, and a little wrapper around that, which helps me find the place and have some more information (like stacktrace and so on).
Console.WriteLine in MT writes to the device's console, so you can check it with the Organizer tool in XCode, and that really works well.
Am not sure if this is the recommended approach, but I use it, works well, and I personally can recommend it.
I am a bit of a iPhone/Mac OS newb.
When I look at a backtrace in the debugger and UIKit or other Apple Libraries are on the call stack I can't see their function arguments because of missing debug symbols.
Does Apple Ship debugging symbols for the iPhone Simulator libraries like UIKit?
Thanks.
No. The OS-level components do not ship with debug symbols, nor have those symbols available to you. On the Mac, the only case I can think of where a special debug version of a framework was made available was for Core Data, but that was more for logging of SQL and other database-related actions.
You can extract a little more information about what's going on in the Simulator using DTrace scripts and custom instruments, which can probe for even private methods and classes. For example, I created a couple of scripts and a custom instrument here that logs out every method that is called in the process of starting up an iPhone application in the Simulator. I describe how that works in this article on MacResearch.
Is there any equivalent to a Flash projector for iPhone? Flash projectors basically seem to package script and Flash libraries into one executable file that can be run on a PC. I'm wondering if anyone has made a similar thing for iPhone where I can take my existing code and package it with the necessary iPhone stuff to make a PC executable. Of course hardware-specific things would not be available like accelerometer/phone/gps, etc. but I don't need any of those. If not, is there anyone currently attempting this?
Thanks for the input guys, but I think everyone except Noah is misinterpreting my question. Flash was just an example, if you hate Flash just pretend I said something else. I am wondering if it is possible to make code for iPhone run on a PC in a similar way to the way a projector works for Flash.
Right now, the only way to run an iPhone app outside of an iDevice is to compile it from source for a non-iPhone target, so it depends on what you're using to compile. If you're authoring in XCode, you can target the Simulator (which is mac-only), but Apple doesn't currently have a way to compile for any other targets, or a way to compile an object file that runs on Macs without the simulator. If you're authoring in Flash CS5, of course you can just publish a projector.
Not at this time. However, Flash CS5 will create iPhone applications.
Flash is not available on the iPhone.
Furthermore, any company attempting to make a Flash runtime -- which would require doing bytecode interpretation -- would run up against Apple's developer agreement, which specifically forbids that.
I think Adobe is planning for CS5 the export to iPhone app feature. It essentially compiles flash's runtime to Apple's cocoa touch framework and produces a true iPhone app, thus circumventing the bytecode interpretation clause. Time will tell, time will tell...
--- Thanks for the clarification Myz... WTB Noah's reading skills, I thought you had typo'd the PC part due to the outrageousness of your question.
If by PC you mean a windows binary simulator interpreting .ipa files. No, such thing doesn't exist and I don't expect to see it for decades. The platform is much more harder to emulate than the old SNES/N64 and others.
I'm writing an iPhone game in objective-C using XCode. I'd like to profile the performance of my code. What is a good profiler to use?
Have you tried Shark? it comes with the developer tools.
Apple provides a program called Instruments, which is included with the iPhone SDK download, that really is excellent. It allows you to view memory leaks, animation performance, and a bunch of other stuff.
The developer tools you downloaded also included a great app called Instruments. You'll find it in your Developer folder next to Xcode:
/Developer/Applications/Instruments.app
Instruments works great for profiling and also has some preset modes that you can use to track down memory leaks, view how many instances of various objects have been created, monitor your OpenGL performance, etc.
To use Instruments, just build your app in Xcode, then while still in Xcode, launch Instruments from:
Run > Start With Performance Tool > Instruments Templates
…then select the type of performance monitoring you'd like to do.
Shark is an incredible profiler, included as part of Apple's CHUD tools, with XCode. If you can get that to run in, say, the simulator, you will be extremely pleased with the results it provides.
Just wanted to plug a set of profiler macros I created for iPhone. You can profile in the traditional sense vs sampling w Shark. It also doesn't require any special tools and the output is saved to a file in your app's Documents folder.
http://code.google.com/p/iphone-quick-profiler/
.n