IOS Other-NSLog logs are saved to the document directory when the real machine is debugged

Source: Internet
Author: User

The following methods are all in the APPDELEGATE.M

-(void) redirectnslogtodocumentfolder{


NSString *filename =[nsstringstringwithformat:@ "%@.log", [Nsdatedate]];
NSString *logfilepath = [Document_pathstringbyappendingpathcomponent:filename];
Freopen ([LogFilePath cstringusingencoding:nsasciistringencoding], "A +", stderr);
}
-(BOOL) applicationuiapplication *) Application didfinishlaunchingwithoptionsnsdictionary *) launchOptions
{
make a real-machine debug Save log file
Uidevice *device =[uidevicecurrentdevice];

if (![ [Device model] isequaltostring:@ "IPad Simulator"]) {
[Selfredirectnslogtodocumentfolder];
}

Project configuration Shared files

You can use the following steps to enable the application to support file sharing: Add the Uifilesharingenabled key to the application's Info.plist file and set the key value to Yes. Place the files you want to share in the documents directory of your application. Once the device is plugged into the user's computer, ITunes 9.1 displays a file sharing area in the Apps tab of the selected device. The user can then add files to the directory or move the files to the desktop computer. If the application supports file sharing, the application should be able to recognize and respond appropriately when the file is added to the documents directory. For example, an application can display the contents of a new file on the interface. Do not present a list of directories to the user and ask them what they want to do with the file.

Then through real-machine debugging, view shared files via itunes

IOS Other-NSLog logs are saved to the document directory when the real machine is debugged

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.