-->

Access CrashReporter files in app iOS 5 **ENTERPRI

2019-07-15 13:42发布

问题:

stop reading if your are going to say something along the lines of "blah blah private API usage will get rejected blah blah"

This is for an enterprise app

in iOS 5 i am trying to send current crashlogs to my server from the clients iPads. They have a management software but there is no way to get the crashlogs from it, just the console log which is not helpful in this instance.

I have tried just reading the contents of the /var/logs/CrashReporter using

NSError * error;
NSArray * directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/Logs/CrashReporter" error:&error];

but get

Error Domain=NSCocoaErrorDomain Code=257 "The operation couldn’t be completed. (Cocoa error 257.)" UserInfo=0x197e80 {NSUserStringVariant=(
    Folder
), NSFilePath=/var/mobile/Library/Logs/CrashReporter, NSUnderlyingError=0x198370 "The operation couldn’t be completed. Operation not permitted"}

I have also tried NSFileManager contentsOfDirectoryAtURL: and had the same error

I have looked for a private API to access the files outside of the sandbox but do not see anything that sticks out.

Is there another way to get EXISTING crash logs off of the device? I am looking into implementing one of the existing third party crash logging bundles but I need access to the current logs on the device because this crash is not easily re-creatable and the devices are also not readily accessible. The users do not sync with iTunes either so I cannot get the logs from there.

i know it is possible, at least in a jailbroken environment, because of apps like iFile that do it. and in a jailbroken environment, i do see the same error as a non-jailbroken environment with the code above.

any suggestions?