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.
So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step.
Debugging an application involves building the application in debug mode (iOS or Android) and launching the application in an iOS or Android emulator or device. You can then use the Google Chrome debugger to debug the application.
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
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With