读写plist文件的奇怪问题

问题描述

| 我有一个从plist文件读取信息的应用程序。为此,我使用以下代码:
  NSData *plistData;  
    NSString *error;  
    NSPropertyListFormat format;  
    id plist;  
    localizedPath = [[NSBundle mainBundle] pathForResource:@\"settings\" ofType:@\"plist\"];  
    plistData = [NSData dataWithContentsOfFile:localizedPath];   

    plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];  
    if (!plist) {  
        NSLog(@\"Error reading plist from file \'%s\',error = \'%s\'\",[localizedPath UTF8String],[error UTF8String]);  
        [error release];  
    }  




    NSString *tel=[NSString stringWithFormat:@\"tel:%@\",[plist objectForKey:@\"number\"]];
    NSURL *telephoneURL = [NSURL URLWithString:tel];
    [[UIApplication sharedApplication] openURL:telephoneURL];
要编写它,我使用以下代码:
- (IBAction) saveSetting:(id)sender{



    NSData *plistData;  
    NSString *error;  
    NSPropertyListFormat format;  
    id plist;  

    NSString *localizedPath = [[NSBundle mainBundle] pathForResource:@\"settings\" ofType:@\"plist\"];  
    plistData = [NSData dataWithContentsOfFile:localizedPath];   

    plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListMutableContainers format:&format errorDescription:&error];  
    if (!plist) {  
        NSLog(@\"Error reading plist from file \'%s\',[error UTF8String]);  
        [error release];  
    }  

    NSLog([plist objectForKey:@\"message\"]);
    [plist setValue:textMex.text forKey:@\"message\"];
    NSLog([plist objectForKey:@\"message\"]);

    NSLog([plist objectForKey:@\"number\"]);
    [plist setValue:textNumero.text forKey:@\"number\"];
    NSLog([plist objectForKey:@\"number\"]);

    [plist setValue:@\"NO\" forKey:@\"firstTime\"];

    [plist writeToFile:localizedPath atomically:YES];

    [self aggiorna];




    [settingScreen removeFromSuperview];

}
现在,我遇到了一个大问题,该应用程序可以在我所有的开发人员设备和模拟器中正常运行,并且该应用程序可以正确读写文件。 我在Apple Store上提交了该应用程序,但其他用户无法读取/写入此文件。 为什么这个? 谢谢 保罗     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)