How to debug after closing the application

I am trying to reproduce a problem that requires closing and re-opening my application in a specific place. Here are my questions:

1) How to view my logs (using the command NSLog) when my iPhone is not connected to Xcode?

2) Is it possible to set a specific location (for example, the city center) for the iPhone simulator by default? I use GPX files, but every time I start a project from scratch, the location is set to unknown.

+4
source share
3 answers

If you want to see the logs from your application
under Xcode, select the "Window" submenu and the "Devices" submenu (you can use shift + cmd + 2)

Device sub menu

on the screen that opens, at the bottom of the screen, you will see the log from the device, even if it is not in debugging state (if you do not see it, find the small up arrow in the lower left corner and click in the subject log screen ).

If your device has not been connected, you can see crash reports there when you connect it

+6
source

(1): NSLog , testflight. , xcode, , , ? , "" , , . , .

, , , , NSUserDefaults:

NSMutableArray* logs =
[[[NSUserDefaults standardUserDefaults] objectForKey:@"logs"] mutableCopy];
NSString* log = [NSString stringWithFormat:YOUR LOG HERE];
[logs addObject:log];
[[NSUserDefaults standardUserDefaults] setObject:logs forKey:@"logs"];

,

NSMutableArray* logs =
[[[NSUserDefaults standardUserDefaults] objectForKey:@"logs"] mutableCopy];
NSLog(@"logs %@",logs);

(2): , , iPhone Simulator xcode. iPhone Simulator, ( xcode, ) . .

+2

iConsole .

, , Xcode .

0

Source: https://habr.com/ru/post/1534411/


All Articles