`

NSString保存到本地,读取

    博客分类:
  • ios
 
阅读更多

保存到本地:

 NSError *error = NULL;
        BOOL success = [str writeToFile:document_cache_forum_top atomically:YES encoding:NSUTF8StringEncoding error:&error];
        if(!success)
        {
            NSLog( @"error saving to %@ - %@", document_cache_forum_top, [error localizedDescription] );
        }

 

读取str:

NSError *error = NULL;
        NSString *str = [NSString stringWithContentsOfFile:document_cache_forum_top encoding:NSUTF8StringEncoding error:&error];
        

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics