NSData dataWithContentsOfFile returning null

前端 未结 6 877
再見小時候
再見小時候 2021-02-19 11:19

I am trying to fetching a JSON file which exist in my xcode resources using this code

-(void)readJsonFiles
{
    NSString *str=[[[NSBu         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 11:44

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"txt"];  
    NSData *myData = [NSData dataWithContentsOfFile:filePath];  
    

提交回复
热议问题