How debug after closing application
I am trying to reproduce issue, which requires to close and reopen my application with a specific location. Here’s my questions:
1) How can I view my logs (using
NSLog command) when my iPhone is not connected to XCode?
2) Is it possible to set specific location (like center of the city) for iPhone simulator as default? I use GPX files but every time when I run project from scratch the location is set to unknown.
- Reading the GPS data from the image returned by the camera in iOS iphone
- Calculate distance between two place using latitude-longitude in gmap for iPhone
- GMSMarker bouncing around the corners on GMSPolyline
- How does the iPhone learn new WiFi locations in terms of using them for location estimates
- Best option for supplying Quadtree GPS Data to an app?
- iPhone GPS Development - Tips + Tricks
3 Solutions Collect From Internet About “How debug after closing application”
Answering your (1) question:
Instead of using NSLog you can just print your logs to a file or use a remove loging framework like testflight. I am not really sure why you have to disconnect your app from xcode thought, or do you mean you have to terminate the debuging session by closing the app? If that is the case, if you just ‘run’ again, the starting point should be similar as if you just started the app. If you put the app to background, the debug session is not canceled.
Maybe even easier than storing them in a logfile you can just append your logs to an array that you store in the NSUserDefaults:
NSMutableArray* logs = [[[NSUserDefaults standardUserDefaults] objectForKey:@"logs"] mutableCopy]; NSString* log = [NSString stringWithFormat:YOUR LOG HERE]; [logs addObject:log]; [[NSUserDefaults standardUserDefaults] setObject:logs forKey:@"logs"];
You can later read them if you use
NSMutableArray* logs = [[[NSUserDefaults standardUserDefaults] objectForKey:@"logs"] mutableCopy]; NSLog(@"logs %@",logs);
Answering your (2) question:
I don’t know whether you are aware that you can make the iPhone Simulator simulate a location without xcode. When you are in the iPhone Simulator go to the Debug Menu (not in xcode, in the simulator) and go to the location. This location remains between closing the app and reopening it.
If you want to see the logs from your application
under XCode choose ‘Window’ sub menu and there ‘Devices’ sub menu (you can use shift+cmd+2)
on the opened screen in the bottom of the screen you’ll see the log from the device even if it isn’t in debug state (if you don’t see it locate the little up arrow in the bottom left and click on it
if your device weren’t connected you can see crash reports there when you connect it
I use iConsole to view log just inside the app.
It is very helpful when I need to test a app with multiple devices together, in which case I could not connect them to Xcode at the same time.
- iOS: Get pixel-by-pixel data from camera
- Xcode stupid warning: View is clipping its content
- UITableView filtering
- dateFromString always returns null with dateformatter
- Add a CALayer sublayer centered over UIImageView
- How use and run Swift 2.3 on command line
- Swift reusable UITextFieldDelegate
- Mac OSX asking for keychain access when building MonoDevelop iOS App
- Multiple CGAffineTransforms in Swift 3
- Why is my CLLocation speed so inaccurate?
- How to give photo to dialog from user's blob id?
- Best practices for overriding isEqual: and hash
- UICollectionView interactive layout transition using iOS 7 APIs
- In ARC do we need to send removeObserver: explicitly?
- Adding constraints in SDCAlertView