开发者

objective c iphone : can we view console log on device [closed]

As it currently stands, this question is not a good fit for 开发者_StackOverflowour Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

is there a way to view the console output as we are running an iphone App on the device? If not directly, is there an app on the App store which lets you view the log after the App has finished running?


Update to use Xcode 12.5.1 and Console 1.1:

In Xcode go to Window->Devices and Simulators, select your device and press on "Open Console" button.

Or directly open Console by pressing cmd+space -> type "Console" and press enter.

In the Console app select your device from left pane and press on "Start streaming".

objective c iphone : can we view console log on device [closed]


You can also see in Devices window.

Go in xcode -> Window -> Devices.

Select your device and open the console.

objective c iphone : can we view console log on device [closed]


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *fileName =[NSString stringWithFormat:@"%@.log",[NSDate date]];

NSString *logFilePath = [documentsDirectory stringByAppendingPathComponent:fileName];

freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);

Just add this block of code in applicationdidFinishLaunchingWithOptionslaunchOptions method in app delegate file, and it will create a log file in app Document Directory on iphone which logs all console log events. You need to import this file from itunes to see all console events.

Dont Forget to set "Application supports iTunes file sharing" to "YES" in Your plist

Goto - itunes -when ur device connected-Apps - select ur App - in Augument Document u will get ur file then save to ur disk


if you have a paid iphone developer account, you can use the organizer window in xcode to view the console and app logs on your devices.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜