,我不能讓我的存儲的數據....這是代碼:問題存儲數據
if ([string isEqualToString:@""]) {
//RECUPERO DATA
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *pathToDocuments=[paths objectAtIndex:0];
pathToDocuments=[pathToDocuments stringByAppendingString:@"getSubscriptionsListShowOnlyWithUnreadFeeds.txt"];
NSLog(pathToDocuments);
dataReply=[[NSData alloc] initWithContentsOfFile:pathToDocuments];
NSString *string = [[NSString alloc] initWithData:dataReply encoding:NSASCIIStringEncoding];
NSLog(@"string recuperata %@",string);
}
if ([string isEqualToString:@""]==NO) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *pathToDocuments=[paths objectAtIndex:0];
pathToDocuments=[pathToDocuments stringByAppendingString:@"getSubscriptionsListShowOnlyWithUnreadFeeds.txt"];
NSLog(pathToDocuments);
[dataReply writeToFile:pathToDocuments atomically:YES];}
有什麼錯嗎?
編輯 沒有錯誤沒有崩潰,但NSLog(@"string recuperata %@",string);
打印一個空字符串! (數據存儲在設備中,因爲我已經運行至少一次我的應用程序時,字符串!=空 謝謝
你得到任何錯誤/崩潰/錯誤? – Stuart
沒有錯誤,沒有崩潰...但是NSLog(@「string recuperata%@」,string); –
沒有錯誤沒有崩潰,但NSLog(@「string recuperata%@」,string);打印一個空字符串! (數據存儲在設備中,因爲我已經運行至少一次我的應用程序時,字符串!=空 –