Has anybody had any success ever attaching a debugger to a tethered device? I am able to debug my j2me application in the emulator, but have a lot of trouble sorting out phone-specific problems when they come up. The phone I'm using is a Nokia N95, but ideally the debug process would work on any phone.
Is this possible? If so does anyone have steps they've used to set it up?
Sony Ericsson supports debugging on ebery phone at least since K700, this is done by using KDWP. UIQ 3 communicators also can be debugged the same way.
By the way, it the latest phones by SE it is even possible to monitor memory consumption and CPU profiling. So if you wanna debug your apps on real phones, I would suggest also using SE phones, they are really good at it. I use Netbeans, and it works without any problems with any SE phone.
Motorola phones support a debugging interface called KDWP(Motodev registration required).Their MIDway tool can also be useful for getting debug trace information from a midlet running on a device.
As other stated, on device debug is something that strictly depends on manufacturer's will and often it's nearly impossible. However, i can address you to Gear Java Mobile Framework that gives you the opportunity to use an on-device debug console to print your messages and thus read phone specific issues. If you need some explanation on how to use it, take a look to this tutorial
Unfortunately this is not generally possible. Some makers (like Sony-Erricson) support this on some of their phones but not all. I am not sure if there is on-device-debugging tool for N95 but you can use Nokia's emulator which should be pretty close to the device. The new Java ME SDK comes with promise of real ODD in near future. But it still very much depends on OEM cooperation.
I find a good debugging method is to control a string value which gets painted on top of everything else when it is not null. This will work anywhere, though obviously isn't ideal, but can be used to catch Exceptions, print values etc. Of course you're limited to the small screen, but in theory you could even code some scrolling functionality.
Some people use RMS logging but personally I could never be bothered.
As others have said here, Motorola have Midway which I think is great.
Others are correct here in that on-device debugging is very much device specific. I haven't done anything with Series 60, but at least on Series 40 phones, I had to open up a CommConnection and write out to it in order to see much of anything going on. The device emulators are again a mixed bag, but you usually can get 90% of the way to your application working on them and can usually get your debugger connected to them. If you aren't making use of any of the hardware on the phone, that should get you most of the way there.
I've used the Blackberry tools on occasion to debug J2ME applications (without using RIM APIs) but it is very slow and still is only emulation, not the actual device (but it sometimes does help to shake the odd thing out). I agree it is frustrating when you have something running on an emulator only to find that it doesn't run on the hardware.
You can not debug step by step like android or other SDK.
In J2ME you can trace the error by adding the log statement in the code and add another midlet and display that log screen in that midlet.
Example: add Log.p("Log statement.....");
LogMidlet.java
// Add the following line in the startup method of this midlet.
Log.getInstance().showLog();
This way you can somehow track the error in j2me.
I think it is possible to add additional debugging information on preprocess step. Like this:
public void myMethod() {
Debug.traceMethod("myMethod");
int var = 1;
Debug.newLine();
var++;
Debug.newLine();
...
}
Related
I'm working on trying to launch an automated testing solution for some iOS applications. I'm using fruitstrap to transfer and install a compiled app over to the connected iPhone, but I'm struggling to find a way to automatically launch the application after the installation is complete.
Fruitstrap has an option to run the app in the GDB debugger, which works. Unfortunately there are some test cases which will require the app to be run without the debugger attached (special crash handling). I've spent a good amount of time muddling through the resources available on MobileDevice Library which is what Fruitstrap uses, but I haven't been able to turn anything up on launching an App.
Any ideas?
You can do what you want by using fruitstrap or Xcode to start a "bootstrap" program that causes your target application to run via a custom URL as described by Michael.
While the bootstrap program would be running under the debugger the URL-invoked program would be running normally.
Creating a bootstrap program and using URL Schemes may be an option for some people, and certainly should be considered, but it doesn't fit into my requirements.
What I ended up doing was to launch the app with the debugger through fruitstrap. I re-compiled fruitstrap to include the following prep commands (In the GDB_PREP_CMDS define):
handle all noprint pass nostop
continue
The handle will pass the signal on to the program so the custom signal handler (crash handler in this case) will handle the signal. The continue was something I needed so that the app would actually run once the debugger started.
There is one unfortunate flaw in this, which unfortunately I do not know a workaround for. The ARM7 version of GDB does not have the 'set dont_handle_bad_access' command like the darwin version does. For some reason passing EXC_BAD_ACCESS signals to the program does not work and the app hangs. This is significant since this is the signal for most crashes. But as it stands now, its the best I can do, and at least its handling uncaught exceptions.
I believe you may be looking for some sort of Custom URL Scheme.
Have a look at the following document and scroll down to: Implementing Custom URL Schemes
http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
You can also google URL Schemes in iOS to see if you come across something similar to what you are trying to do.
Let me know if this helped you out. Would be interesting to hear if you had any success.
Cheers.
I am wondering how good of an idea it is to start creating iphone applications without actually having an iphone?
I found that there are simulators for iphone...
Are they good enough or is it likely that I might encounter some problems down the road when creating an app?
-I don't have an idea of an app yet.
-I don't have a real iphone. There ARE some handsets in my job's office, though, but I don't want to use them too much.
Thanks! And if you think that it is an okay idea to create apps and test them on simulators, which ones would you recommend?
Bad idea.
You can get a lot of work done but you really, really need an actual device to do your final testing.
Remember that it's a simulator and not an emulator. There are significant differences in performance. Lots of things work fine on your Mac but poorly on an real device. There are, perhaps surprisingly, a number of situations where the reverse is true (i.e., faster on the iPhone). You get better at figuring out these differences after a while, but without working on a real device you'll never know.
If cost is the main factor, you don't actually need an iPhone; you could work with an iPod touch instead.
xCode has an Emulator in itself, so why not? All you need is a Mac-PC
check http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/25-Using_iOS_Simulator/ios_simulator_application.html#//apple_ref/doc/uid/TP40007959-CH9-SW1
Do you have a mac?
iOS SDK has a really good emulator where you can try your apps, and i think if works on it, it should work on a real iPhone.
Consider that the simulator is good enough, to create your app, but it all depends on what you use. For example if you use the accelerometer or the Bluetooth simulator is not suitable to your case. Overall, in many respects is very limited, but to begin with can go just fine.
To use the devices of which you speak, you must have a valid license from the developer and associate devices to your license, otherwise you will not use them (though not with the jailbreak)
the iPhone simulator does not support everything, which is supported by a real device. Some things are impossible to test on a simulator, including but not limited to features/API associated with: calendars, camera, gyroscope, accelerometer, music, ...
The iPhone simulator that comes with xCode is fine for the development of most applications. In my experience the area where it falls down is when you are dealing with stuff that runs in real time such as audio and graphics. The processor on the computer is obviously faster and if you are only testing on the simulator you might not realise that what you are trying to achieve is outside the capabilities of the device.
This could have impact on your frame rate (as you will get a higher frame rate on the computer) and in depth audio with lots of DSP faces the same issues.
If you are developing Line Of Business apps the simulator is probably all you need. Of course you need to test on a device before release, but most of the bug testing and debugging is possible in the simulated environment.
Hey everyone, I'm in a bit of a pickle and am looking for some advice.
I have an app that's been released to the app store..nothing special just a first time sort of thing. The app runs perfectly fine on my device(s) but a couple buddies always get a crash.
So here's the details:
It crashes by sometimes stalling and other times by just exiting to the main screen.
I've tried to replicate the crash (or any crash) using
the same iPhone generation/model
on an ipod touch as well
the same OS
different OS
using debug/release/distribution/downloading from app store builds
since it's an app that connects to a google maps service, I've tried with both
a wifi connection and the att network.
The only thing that MAY be different is any other apps on their phones that are not on mine.
The fact that I cannot replicate with exactly the same setup leads me to believe it's a memory issue, maybe uninitialized variables or incorrect cleanup at some point (i'm from C++, so I know this sort of thing can vary from machine to machine). I'm somewhat new to obj C and may very well be missing something there. I'm just curious to hear what others have to say, does this sound like a memory issue with the info I've provided? Any other ideas to test/suggestions come to mind to try and reproduce the crash?
Thanks!
One possibility is that it's a backgrounding issue. You don't say whether your app tries to use those features or whether your friends experience the crash in that context, so it's hard to say.
I would provision your friends with a beta that logs verbosely if you can't pin it down.
For the sake of coding itself, I know that I don't need to buy iPhone as there's pretty good emulator.
However, as I will develop iPhone apps for clients (will not have direct contacts to clients) via freelancers sites, do you think that I might get rejected (not chosen) by the contractor because I don't have iPhone at home?
Do contractors accept this way of working:
I develop the app, test it in the emulator and send it to them
They test it in iPhone and send me the list of the bugs
I fix the bugs and send them the app back
They find new bugs and...
Yes, or at least an iPod Touch.
To clarify:
Yes. You really need one. Debugging the kind of errors that cause it not to open on the device at all, for example, can be mind-numbingly tedious if you don't have the device handy.
For most purposes, of course, an iPod Touch should do just fine, but the crux of the matter is that the testers can only test what they see; only the developer can actually test crucial stuff, most of the time.
So to repeat. Yes, you'll need a device. A thousand times yes.
Your client may have something of an issue paying money for software that was never tested on actual hardware. No matter how good an emulator is, you should always try the software on the real machine your program will be running on. The emulator will simulate the way the API responds etc, but you could be blindsided by things such as interference from other running applications, subtle timing bugs, interaction between different versions of the firmware or hardware, etc.
In short, I don't think there is a legal reason you have to test on a real iPhone, but from a Q/C point of view, I think there is no question you need the real hardware to run it on.
Paying customers generally dislike being treated as a beta tester.
I don't think that you won't get the clients - but I do think its a terrible idea not to have a device to test on.
There are many things that won't work properly in the simulator. For instance you can't simulate a camera function, you can't simulate GPS (properly - it always sets you at the apple HQ), you can't simulate sound recording, or test with a real contact address book or a real set up. You can't test whether there is an internet connection or if there are any iphone specific bugs.
On the other side of the coin there are loads of things that will work in the iphone simulator that won't work on the device itself. For instance NSXML and such won't work on an iphone, but WILL work in the simulator.
If you can get hold of one of the new ipod touches they do pretty much most things you will need, and you don't have to get into a data plan or anything. I would suggest AT LEAST getting one of those. You can't make apps if you can't test them properly.
Other things:
In app purchases - #Stephen Darlington
Whenever working for clients, the clients do not pay you for having an iphone or not... or being able to test it on a actual iPhone. The clients pay you for the product you deliver. They expect it to work on the device.
My recommendation is to get yourself an iPhone 3, 3gs and 4 if you want the best results. But, if money is a object here... try developing minor projects which are reliable in the simulator. AND ask friends/family which do have iPhones to test it for you on their device. Its better to ask mates to do this, then ask the client, this way you have a better comunication with your client, your client has more faith in you and... well lets face it, it is the developers responsibility to deliver quality code. Right?
There are some tests you cannot perform in the emulator.
And I am not sure contractors will like this ping-pong test approach (somebody will get tired after couple passes).
You can get an old second-gen iPod touch at a very good price since there are many people who would like to get rid of it. And Apple advices to test apps on older hardware to achieve the best performance. So you'd better get something 'hard' to play with.
Another aspect is performance. The simulator (running on a powerful Mac) will be much faster than a device. This was a huge difference with the original first iPhone.
As an alternative to the iPod: look for a cheap original iPhone on eBay or so. But remember that this will not run iOS4.
If been looking around the web and can't seem to find any good solutions to sending allowing your user to submit bug reports from your iPhone app.
How do you handle crashes and exceptions?
Do you send the error user-data to a server,
grab a log file from somewhere and attach,
or do you ignore it and pretend it never happened?
Anybody got any experience with this?
Update
I am aware of how to prepare you software testing it with Static Analysis, Leak Detection, User Testing etc.
But errors might still happen when a user (mis)using my software. Always assume your user is trying to break your software.
What I want to figure out is how (I, or rather the app) can provide me with useful data when/if errors happen. As they do even in top quality products – like my own ofc. :)
I'm looking anyone that has experience with allowing the use to send error reports, stack traces, logs etc. to see how they handle the problem.
Some people use built-in analytics like Flurry which will post exception data to Flurry's website which you can review later.
Also, Apple has a "crash log" reporting area on iTunes Connect, but I'm not sure if it works since I've yet to see something come through and I kinda doubt each and every person has run my apps flawlessly. Not saying I write poor code (hopefully), but not every device is created equal either so I have to imagine it has crashed at least ONCE. There's always the option of logging and sending to a server later though.
Most of the time though, if you give users your e-mail address within the app itself (like on an instructions or about screen), they will e-mail me about any issues. That's a little bit nicer since it gives you a chance to correct the issue before they hit the review forms on iTunes.
You can also try BugSense. It's free, realtime, error reporting for iOS
PS: I am one of the founders.
Crashes most of the time comes with problems of memory management. To test memory leaks and find in your code on to what areas you were leaking a memory. Use the Instruments if your using XCode.
In your XCode go to Run -> Run with performance tool -> Leaks.
You can check everything here when it comes to memory allocations.
Note: To avoid crashes, make sure you released objects correctly and check your scheduled timers as well.
Regards,
ZaldzBugz