Workflow for debugging PhoneGap using Safari's Web Inspector - iphone

I'm developing a phone gap app and using Safari's Web Inspector to debug it. The tool is very useful but there are a couple workflow inefficiencies that are costing me some time.
Every time I stop my PhoneGap app in xCode the Safari Web Inspector window automatically closes leaving me with the task of re-opening it every time I make a change and re-launch the app.
The only way I'm able to get a full read out in the console is by entering window.location.reload(). Again this adds a step to my work flow everytime I deploy a change in xCode.
Does anyone know how to set it up so that Safari Web Inspector stays open and the console automatically monitors the app?

To solve the reload issue, I add this in my head section when I'm debugging:
<script>
alert('connect your debugger, if you want')
</script>
The alert stops all execution, meaning that I can (manually, ugh) connect my debugger and not miss anything. Execution resumes when I hit okay on the alert window.

I'm having the same issues. I haven't solved them yet, and I'm running out of time, so I'll show you what I've got so far:
Create an ActionScript that opens the web inspector:
https://gist.github.com/amuino/5649177 This works!
Have Xcode launch it! I tried creating a shell script that, in turn, opens the action script, but to no avail. This is what I've got:
How to run a script after Xcode runs codesign on my iPhone app?

Actually I found a way around this issue. It's not super elegant but it works.
At the entry point of my app I added some delay with setTimeout, like this:
setTimeout(function () {
app.init();
}, 10000);
This will give you enough time (10 seconds) to reopen Safari Web Inspector and you will get full console read out.
It saved me a lot of headache.

Related

How to make a Chrome OS app quit itself via Javascript

I need to have a chrome app quit based on a js script, but after I've looked through Google's list of JS APIs for Chrome Apps, I'm not convinced there is a way sadly. I've tried having the program throw errors at itself, but chrome simply ignores them and moves on. By the way, this is for Chrome OS.
Perhaps the simplest hack to make a chrome app "quit" would be to set chrome.storage.local.set({dont_start:1}) and then chrome.runtime.reload() and make sure the onLaunched event listener, instead of doing the normal thing like opening an app window, instead checks first if dont_start is set, and deletes that key, and just does nothing (instead of launching the app). Then in about 30 seconds or so the event page will go inactive.

Blackberry - App does not launch after signature

Am facing an unusual problem on blackberry, after i have signed my app with the 3 keys and say "load onto device" via Eclipse Java Plugin for Blackberry - the app loads successfully on the device, but when i click on it to launch it - does not open up, nor even a error or a dialog pops up. Please Help - Cant find a solution for this!
I have often had this issue using the 9800 device. After loading apps to the device it starts "not launching". If you go to options -> application manager -> your app's permissions you might see some permissions as custom. Setting these to "allow" fixes it. After a while it stopped launching even when allowed, deleting the app and letting the device reboot fixes it.
This is my personal experience, I don't know what the official bug/fix is
Implement logging in your application. Log every step on the application startup and write log to a text file, located on device SD Card.
When your application has been installed and you have tried to launch it, check this text file to find out, what is going wrong with your application.
Also there is internal logging mechanism, you may employ it, instead of logging to text file.
From my point of view internal log is more suitable for simple logging purposes. If you want complex logging, then text file located on SDCard is preferred.
Try to start the app, then check the device event log. To open the event log viewer, hold 'Alt' and then press L,G,L,G. You will likely see an error explaining the problem in the event log viewer.

How to handle closing apps with multitasking with Objective C?

I have read some bits and pieces here and there about multitasking, but I am not sure I grasp it all. Basically, I have an iPhone app that runs quite ok on the iPhone simulator (I have yet to pay the dev fee to be able to deploy to an actual iPhone).
In the simulator, I can enter and exit the app, without issue. When I open the multitasking bar (double tap on the home button), I can close the app. When I try to reopen it, I then get an error.
I wonder, is this because testing closing and opening the app from multitasking is only possible on an actual iPhone, or are the some additional events I should be listening to? I have read this: http://www.cocos2d-iphone.org/forum/topic/8767 and added some handlers, but this article feels dated, and it didn't change anything.
Any help is appreciated!
The post about SIGKILL is correct. It is normal behavior for your application. Xcode is just reporting what killed your application the last time. Simply stop the execution and run your app again, and you should be fine.
As Richard said, that is normal. If you want to test it yourself:
Run the app using Xcode.
Stop the app using Xcode. (Press the Stop button which is directly to the right of the run button.
Launch the app by clicking on it in the Simulator's home screen.
Close the app and then close it from the multitasking bar.
Launch it again.
Good luck :)

iPhone 4.3.3 shows wrong(depreciated) 'zoom-in' snapshot(screenshot) at launch

It's hard to describe my iPhone's situation..
I launched an App and used it. for example, a Twitter app.
After that I closed it with Home Button.
Then I launched a few apps which were enough to take most memory.
And, when I launch the Twitter app again, a screenshot(snapshot), which was taken exactly when I closed the app at first, was shown about 0.5~1 sec.
I know this is a way of animation effect, but mine is somewhat wrong,
because that screenshot should be 'loading image (ex: Default.png)' if the app launched long time ago is about to start from the beginning (the 'twitter' app must be closed because of out of memory).
It makes stressful situation when I use kind of 'personal memo app'.
Before I upgrade to iOS 4.3.3, whenever I launch this app, it requires password without showing any old screenshot.
But now, everyone can see my memo because of that automatic snapshot which pops up about a second.
Help needed. Thanks!
Before your app goes into background you need to hide/remove all the views you don't want to appear when you open the app again.
You should do this in the applicationDidEnterBackground: UIApplicationDelegate method.
See the Remove sensitive information from views before moving to the background bullet point in this section of the Apple Developer Docs.
The only way I know to prevent that is to set "Application does not run in background" in your plist file.

error from debugger: the program being debugged is not being run

i have run my application in device but application is crashed and print following message
error from debugger: the program being debugged is not being run.
so please tell me what to do?
my application gonna launch properly but not not debugging first time (gonna crash) than from second time i start application work proper without crashing
my application install in device. we can`t debug in device...
The first thing i do when i get that is a Clean All usually solves that. If you don't see the Clean All button right click your Xcode toolbar, customize, and drag the Clean All button to your toolbar from there.
-Check that the provisioning profile installed on your device haven't expired (would see a red dot in the organizer - Window->Organizer).
-Try restarting XCode.
Do you mean device? If so then it could mean the device is not launching the application correctly. Make sure your developer profile and everything in the build settings is correctly set. This may sound obvious but also make sure the device is unlocked and open.