Assertion failure error in objective c

后端 未结 2 823
忘了有多久
忘了有多久 2021-01-29 15:16

I have Json datas but I got this error assertion failure when I try to insert this records to sqlite database. I can see the datas with NSLog but I can not insert database. What

2条回答
  •  遇见更好的自我
    2021-01-29 15:55

    I dont think your path is correct, it should not be hard coded and should start with file://.

    Use this instead to get the document directory and save there

    NSArray *dirPaths;
    NSString *docsDir;
    
    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
        NSUserDomainMask, YES);
    
    docsDir = [dirPaths objectAtIndex:0];
    

提交回复
热议问题