ios app-on-device debugging events - ios

Newbie here, so apologies if this is stupid question:
Are there any applications or solutions out there that would allow you access to debugging events on an app installed on your iphone? To be clear, this isn't an app I've developed, it's just on my iphone and is used as part of another solution which we are developing. Curious if there's a way to just watch the events on an app to help with debugging process.
Thanks.

If you make an app, and build it with a development release, and development signing, you can select to build+run it on a device. Then, you can use the Xcode debugger to see your logs / errors etc.
Steps:
Plug in iPhone
Start Xcode
Hit Build + run
Watch debugger
Logs are either made by the OS for certain things (NSinconsistency, bad constraints, race conditions in view presentation) or by you with NSLog.
Or did you mean when the app is not tethered to your computer? There are other tools for that - including just plugging the phone back in and downloading the logs off the device.

Related

How to debug react-native iOS app crashing on startup after a week or so

I started messing around with react-native. I've built a small application and it seems to work fine (package.json). I can work on it in Debug or Release mode, using the simulator or my iPhone 6S device, and all is well.
This app is just for me so I don't pay for the Apple Developer thing, and I just run the app in Release mode on my device, and it...seems to be fine? I can quit xcode and go places and the app works fine.
After a week or so, it's hard to tell, the app stops loading. It'll display the splash screen for a split second and then it's gone back to the home screen.
I setup Rollbar, but it doesn't catch anything. I look in the Privacy -> Analytics area and don't see anything there either.
I'm not really looking for an answer to my exact problem since various SO questions and other places suggest it's probably something weird and specific. My main problem is I don't know even where to look/how to debug this kind of thing. If I build the app and run it on device again, it'll run fine. I need to try to debug without loading new code, and have no idea how that works on iOS. I've tried poking around at the Debug -> Attach to Process by Name, but the app never gets far enough to do anything with that.
Alternatively, I throw react-native in the garbage and use something that works...
App provisioning with a free developer license (?) is 7 days. See: Why does my free XCode Provisioning Profile only last 7 days?
You can likely verify this by looking at error messages in the console window. Connect your device, and in Xcode go to Window/Devices and Simulators/Open Console, then launch your app.

Silently Updating iOS Enterprise Apps in Single App Mode

I have a need to update my managed app running on a large amount of iPads without any user interaction. These devices all have the managed app locked in Single App Mode. As I understand it, it's an iOS limitation that an app cannot be updated if either of the following conditions are present:
The app to be updated is in the foreground.
Any app is locked in Single App mode.
With our use case, both of these conditions are present. I also understand that the current workaround is to do the following:
Disable Single App Mode.
Enable Single App Mode for a different app (e.g. Safari) to bring that app into the foreground.
Disable Single App Mode.
Update app.
Re-enable Single App Mode for your app when the update finishes to bring it back into the foreground.
While this method works, it has a lot of drawbacks:
It's highly manual, we have not found a way to automate it. This is especially a problem as the number of devices becomes large. Internet connections can be spotty and there is no robust way to ensure that each step has executed for all devices.
It's prone to failure. Especially between steps 4 and 5 above. It seems there are little to no guarantees of when/if an update was successful to know definitively when to re-enable Single App Mode.
It fails for devices that are offline at time of update. If a device does not have internet connection when the update is executed, there is no way to guarantee that the steps execute fully and in the correct order the next time the device comes back online.
I am looking for a scalable solution to reliably update my managed, Single App Mode app running on thousands of devices in an automated way with no user interaction. I am using Meraki for an MDM right now, for what it's worth.
With iOS 11.2 you can now push a silent update to a device with it running SingleApp mode.
Apple failed to mention this to the public but is included in the beta notes.
Called Enterprise Support today, They could not find any official documentation mentioning ios 11.2.x supports the updating of apps while in single app mode :(
Now with iOS 11.3 beta it is working again but after updation, app is not automatically locking in Single App mode we have to restart device.
Hope in upcoming beta's this issue will get addressed.
iOS 13.1 beta 1 seems to fix most of the issues I have been having in this area.
I had seen issues in iOS 11-12.* where updates sometimes worked, but sometimes showed a pin-pad even though no passcode or guided access code was set, or otherwise behaved strangely.
In the 13.1 beta 1 you can push an App update and nothing will happen on the device, but if you send a restart command afterwards the device will restart, update the App and continue in single app mode.
I have tested with both 'Single App Mode' (SAM) and 'Autonomous Single App Mode' (ASAM) and it has worked every time for me so far.
This works for my use case as you can push the update anytime and schedule the restart at suitable time when the device is not in use.
edit: 13.1 beta 2/3/4 changes this, now when you push an update from your MDM the App will close, update and re-open and continue in single App mode. I checked both SAM and ASAM both now update without the need for a restart.

My iOS app every now and then refuses to launch until I reinstall it

I've got an app that uses Core Data that sporadically stops launching so I have to reinstall it using XCode and then it launches again like normal for a while, with all the Core Data information still preserved.
I have seen that an app often stops launching when the target of an app is too low in comparison to the device software version, however this is not so for this app and device (iPhone 6s).
Have you had such an issue before? What do you think could be causing this problem?
There are many, many, many things that could cause an app to fail to launch. You need to narrow things down and collect some data so that you can find out what the problem is and do something about it. Right now you don't even know that it's related to Core Data, you're just guessing.
For a crash on launch, look at the device console and see what messages appear when you try to launch the app and it fails. You can get the device console messages by
Connecting your device to your Mac
Opening Xcode's "Devices" window (cmd-shift-2)
Looking in the bottom half of the window
A better way to watch the console is to use the free iOS Console app.
The problem was that, as mentioned by dan in the comments, the code was being signed for a short period of time (7 days) and so I had to keep re-installing it on the iOS device to keep it working. Thus to keep the app working indefinitely a paid developer account is needed.
Also mentioned in this reddit forum:
https://www.reddit.com/r/jailbreak/comments/4hotx3/news_free_developer_account_installs_reduced_to_7/

Debugging - Capture The State Of An iOS App

My app has a bug, which I am unable to replicate when it is run when plugged into the computer.
I see it three times a day and it is quite annoying.
Is there any way to capture the state of the app (when not connected to the computer) and see what's going on? Kind of like what XCode does when you use a breakpoint, but somehow send the data to it (or some order tool that I am unaware of) wirelessly.
UPDATE:
The app does not crash. It's just that certain UITableViewCells don't work as they should at certain times.
Try using Crashlytics its awesome for crashes. You should also use TestFlight which will give you live sessions/logs of your app. These both combined will tell you many things.

Debugging Corona SDK application on device

I am working with Corona SDK for some time, and i really like it, but there is one thing, that i cant figure out: How to debug my code on a real device?
At the point, when my code runs great in the simulator, i usually compile it, and try it on the phone. But when there is some error, that doesn't bother the simulator, but pisses the phone off, i simply see an error message:
"This application encountered a Lua error (see logs) etc."
Me and my boss spent a whole day figuring out, that i made a require with a capital instead of lower case.
My question is: How to actually "see" that log? I tried to connect my device to DDMS, but i saw no relevant output. Is there a way to access that log (I'm testing on an android device)? Or is there a way to simulate the EXACT behavior of the phone in the simulator? Usually the phone freaks out because of i/o operations, and when using the wrong case.
The best way to debug on iOS devices is to use XCode's Organizer with your device plugged in via the USB port. On the left hand panel of Organizer, there will be a block for each device that XCode knows about. You may have to click on a button "Use device for debugging" or something similar so XCode can gather all the information it needs.
Once done, then you can use XCode to install the app to the device (you don't need to make an .ipa file, just copy the app to the device via Organizer). In that panel on the left, there is a link for "Console Log", click that and you can your print statements and other errors issued by Corona SDK.
Rob
If you don't have Xcode, you can try iPhone configuration utility. It is more light-weight than the xcode plus you can also use it on a windows machine.

Resources