Does anybody know of a 3rd party profiler for XCode with the iPhone?
I really don't like instruments, it's a pain to try to figure out whats going on. Allocations and leaks are fine, its just the CPU Sampler that I don't like.
I really liked Shark but they have stopped updating that and it doesn't work with iOS4.
I doubt that there are any, since (as far as I know) there is no published documentation from Apple as far as the protocol to use when communicating with the iPhone and attempting to profile a running application.
Related
When testing my app, everything runs fine on the iOS simulator, but I experience memory leaks when running the same app on a physical iOS device. I am new to developing iOS apps and I know that are many potential reasons for this. I want to know why things are different between the simulator and a physical device and if there is a way to solve my memory leak issue?
I would suggest you go through the tutorial below. It will help you a lot to understand how to debug your memory problems and other issues.
My App Crashed – Now What? 1/2
My App Crashed – Now What? 2/2
hint: your problem can be solved with zombie objects; but I advise you to follow the tutorials first.
I'm surprised that you have a leak in your device and not in the simulator. How did you conclude that? Both could be leaking, but the problem is just being manifested differently on the different platforms or simply encountering the problem more quickly on the device than the simulator.
If you have a leak, I'd suggest two things:
Run your code through the static analyzer (select "Analyze" from the "Product" menu in Xcode). Newer developers tend to ignore this incredibly useful tool. I know that I finally mastered my Objective C memory management techniques only after going through the analyzer results and really understanding (and resolving) each and every issue in a really big project I had. Anyway, if you're getting any warnings there, you really should fix them, as they're often indications of memory management problems.
Run the program through the profiler. See the Finding Leaks documentation.
Yes, there is a difference (sometimes an annoying large one) between the simulator and the device. This is because the underlying hardware of each is quite different. Obviously the simulator is simulating the iOS hardware, but that doesn't make it foolproof. With certain APIs and frameworks, things may ONLY work on the hardware, and sometimes bugs will occur on the hardware that didn't occur on the simulator. Just think of it as the "adventure" of iOS development.
As for resources, I'd take a look at #Arab_Geek's links, and also Apple's Tools for iOS Development - specifically Instruments, like Leaks.
I am planning to create a iPhone/ipad application which can check for allocations and leaks of the applications available on the device. Currently i don't know whether there are any existing API's(which may be private since am not planning to submit it to app store) for achieving this.My thought may be bit crazy but can anyone lemme know whether it's feasible or not.
iOS applications are sandboxed -- one app can't look at the memory or resources of another. So there's no way you're going to be able to write an app that detects leaks in other apps. The story may or may not be different if you're willing to jailbreak your device, but finding information in that case will prove difficult.
Update 1: (got your question wrong!)
Analyzing other apps within a iOS app is not possible on un-jailbreaked phones (sandboxing).
If you can do a jailbreak, try to compile valgrind on iOS (very hard!) and build a GUI (iOS app) around it.
if you search leaks in your app (different question):
For memory leaks you don't need API's.
I would recommend you...
... use ARC.
... use valgrind (popular c instrumentation framework) for iOS (simulator only).
When you find and fix leak in the simulator, the chance is >99.9% that they are also fixed on iOS device builds.
But why not using Instruments?
Here's my situation:
I've got a personal iPhone 4 that I use day-to-day, and I was thinking of using it for development.
If I do enable my iPhone for development, will there be any noticeable difference with regards to the performance of the device?
Thanks
Not significantly. If there's any diagnostic information that needs to be collected, it's crash logs, which are already generated on a regular basis by all devices from day 1. When you enable your device for development, Xcode just collects information about it once, presumably to know how to decide how to work with it as you build and test your apps.
You may have debug versions of your apps on your iPhone, but I seriously doubt they will affect OS performance. Even if they do stuff that causes them to slow down it should only happen while their debuggers are running.
Anyway, when it comes to using your personal device for development, I am sure there are other, more important concerns than performance.
Anecdotally, my white iPhone 4 disagrees that it was "violated" in any way by Xcode. In fact it seems pleased to work with it. But that could be just because it knows a developer owns it, so it gets itself in the testing mood.
I think the performance difference is minimal. All iOS devices in our house are enabled for debugging (because I like to try out my apps on all sorts of devices) and I haven't been able to tell the difference.
But it might be something personal, something you would have to try for yourself. Just make sure you make a backup of your device, before enabling. If you think it slows down your device to much, just restore to the backup.
I've registered/paid for the iPhone developer program, which allows me to test apps on a device. I have an old 3G that I would like to use. However, I'm interested in using the significant change notifications as well as it working in the background.
If I were to jailbreak to enable background processing and things like that, what issues could I have, and how likely are they to arise?
EDIT:
I actually do have an iPhone4, but I'm using it for my personal phone. I've heard that it's not to great of an idea to use your everyday phone as a development device. I've done a little more reading, looks like I could use Ad-Hoc distribution to test while avoiding the problems of using your primary phone as a development device. Seems like the only downside of this would be no debug info, other than logs.
iOS 4 has been hacked to allow home screen wallpapers and multitasking on iPhone 3G. (http://pixelatedgeek.com/2010/06/ios4-jailbreak-and-multitasking-now-available-for-iphone-3g/)
It seems to be running fine without any issues, probably not as fast as an iPhone 3GS or iPhone 4.
Just be careful if you use this as your main testing device and make sure you test on supported hardware before releasing. Personally, I'd use something that was 100% supported to be sure everything worked as expected. However, if you don't own a supported device this may not be possible.
Again, make sure you test on friends 3GS or 4 before releasing. I don't foresee any major issues, but testing features on hardware that isn't officially supported could cause problems.
Update: I've used my phone for development purposes before and haven't run into any earth shattering problems. If an issue comes up you can always restores your device.
If you are planning to target iOS4 you really, really really should spring for an iPhone4. You can understand how things will run on it, and also be able to see how the higher resolution display interacts with your app. I'm not sure running iOS4 on a hacked 3G will tell you much more than running in the simulator, and in fact because of the reduced memory may show some issues that just do not occur on real devices.
One other great option is a recent generation Touch. Although it doesn't give you the display to check against it is a good test platform for multitasking.
Want to write a site for the iphone, but I don't have one and I don't know anyone who has one.
Is there a way to develop for it without having access to one, maybe apple has some sort of sim for this or something.
Anyone know of anything?
An iPhone simulator is included with the iPhone SDK, which can be downloaded for free from here:
http://developer.apple.com/iphone/program/start/register/
Or, if you have the Safari web browser, you can use this for a fairly accurate result:
http://www.testiphone.com/ or http://iphonetester.com/
There's a iPhone simulator for Aptana (should work on any system) and an emulator Apple provides (if you have a Mac). I've not tested the Aptana one. The Apple one is pretty good, but it runs most web stuff much faster than the actual device.
Try buying an iPod Touch. It has most of what you need to test your code to make sure it's iPhone ready.
The simulator is available for convenience but you won't be able to check proper HIG such as buttons or text being too small.
For a quick test, try regular Safari zoomed until the dimensions of viewport are similar to those of iPhone. Safari exists for Windows too :) Moreover, you can ask it to present itself as iPhone (in the Develop menu) and try a couple of sites.
For a serious development you definitely need iPod Touch. You'll need to have a familiarity with how interface, both native and mobile web, works. The SDK won't be able to give you that.
I wonder though what kind of application you are developing. I don't think web-based applications are that useful or bring revenue at this moment.
I'd suggest running VM ware booting up Mac OS...
You'll need an intel CPU though but still, worth it.
See here:
How to load Mac OS Lion in a VM