Search code examples
iosobjective-cjailbreak

JailBreak | Cannot access folders inside /private/var/mobile/Library


I am developing an app for Jailbroken iOS devices that access Safari history. History.plist file is placed at following path.

/private/var/mobile/Library/Safari/History.plist

I have successfully installed my app on jailbroken iphone by following tutorial Use your jailbroken iPhone in Xcode for developing

When I try to access above path using fopen command of C, I can not access it. My code is below

FILE *fp = fopen("/private/var/mobile/Library/Safari/History.plist","r"); // read mode
        if( fp == NULL )
        {
            NSLog(@"This file does not exist");

        }else{
            NSLog(@"This file exists");
        }

It returns NULL file pointer. I have Googled this and got to know that since my app is still in sandbox so I am not able to access above path. Couple of posts including [Why SandBox in iOS 6.1.1 still exists for App even after I have jailbreak?][2]

[2]: Why SandBox in iOS 6.1.1 still exists for App even after I have jailbreak? and [how to get the message when receiving the “kCTMessageReceivedNotification” notification on IOS5][2]

[2]: how to get the message when receiving the "kCTMessageReceivedNotification" notification on IOS5 suggest that the app needs to move outside sandbox in order to access the complete file system. I am confused about this. Can you please guide me how can I access this path? Best Regards


Solution

  • Usually you will get a message in the console saying that access was denied. If the sandbox is indeed doesn't allow you to access browser history then you need to move your application outside of the sandbox. To do that you can copy your application into /Applications directory where all system apps are. You can do it using ssh, iExplorer or anything else that can access root folder of iOS device. Read this, the "The actual signing part" part. You can skip ldid stuff, you don't really need to sign anything unless you need to sign your app with entitlements.