Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
673 views
in Technique[技术] by (71.8m points)

ios - Accessing the iPhone SMS file

I try to access sms db file in xcode but fail. I know its path that is "/private/var/mobile/Library/SMS/sms.db" When i try to access. the file read no permission error occur.

Is any way to access sms db file or change its permission in xcode. Thanks in advance. The code which i try on iphone jailbroken is

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = @"/var/mobile/Library/SMS/sms.db";
NSError *error;
NSArray *content = [fileManager contentsOfDirectoryAtPath:path error:&error];
NSLog(@"%@", error);
NSLog(@"Content: %@", content);
if ([fileManager isReadableFileAtPath:path]) {
    NSLog(@"");
    NSLog(@"ReadAble");
}
else {
    NSLog(@"Not readable");
}
if ([fileManager fileExistsAtPath:path])
    NSLog(@"File Exist");
else
NSLog(@"No");

further when i try to call_history.db file . it is accessible. but sms.db not.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No, there is currently no way to do so on stock iOS. It is restricted by the framework itself, and thus not possible as it is.

On a jailbroken iPhone this is possible, but it will perhaps only work on the same jailbreak of the very same version.

EDIT: One other solution, which won't pass to AppStore, is to find some exploitable bug in the iOS (there must be a lot, check out how jailbreaks are done) to gain root access in your app. Then you would be able to access the data you want on a non-jailbroken iPhone. But it will probably only work on the version on which you developed it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...