在应用程序之间传递数据 - 越狱iOS应用程序开发

时间:2014-04-01 03:07:34

标签: ios sandbox jailbreak file-access logos

我正在试图进行越狱的iOS调整,并提出了一个问题。我需要在应用程序之间发送一些数据。我采取的方法是将数据(一个简单的字符串)保存到文件中,然后从其他应用程序访问它,因为我的设备已越狱,但我无法弄清楚如何执行此操作。由于沙箱问题,如果您尝试在应用目录之外写入数据,只需调用[NSString writeToFile:]就不起作用了。我还尝试使用C写入我的apps目录之外的文件,使用this SO答案作为指导,但这也没有用。如何在我的apps目录之外保存文件?如果应用程序正常运行,我也会在应用之间传输数据的替代方式。另外,我在iPhone5和ios 7.0.4上测试了这个。

谢谢!

编辑: 如果我使用此代码:

%hook TKToneTableController
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2{

    //int section = [arg2 section];
    //int row = [arg2 row];

    NSError *error;
    [@"TESTTEXT" writeToFile:[NSString stringWithFormat:@"%@/test.txt",kBundlePath,nil] atomically:true encoding:NSUTF8StringEncoding error:&error];

    UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Yo!" message:[NSString stringWithFormat:@"%@",error,nil] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
    [testAlert show];
    %orig(arg1, arg2);
}
%end

它不起作用,我看到此错误消息: enter image description here

我也尝试过这段代码来保存字符串:

FILE *file = fopen("/debugging_private_data.txt", "w");
if(!file){
    // log an error opening file
} else {
    fprintf(file, "TEST");
    fclose(file);
}

但它也不起作用。我也尝试使用上面的C代码保存到目录/Library/Application Support/但它仍然无法正常工作。

0 个答案:

没有答案