NSFileManager creating folder (Cocoa error 513.)

前端 未结 4 1146
深忆病人
深忆病人 2020-12-02 17:33

I\'m trying to create a folder inside the /sounds folder of my app.

-(void)productPurchased:(UAProduct*) product {
    NSLog(@\"[StoreFrontDelegate] Purchase         


        
4条回答
  •  渐次进展
    2020-12-02 18:06

    I encounter the same problem, when using a Log library. Finally, it's path format problem. Check the dataPath format. If it is Case 1, it is valid. In my case, it's Case 2, so I failed to create directory.

    // Case 1
    /var/mobile/Containers/Data/Application/5FB2CD2D-91DC-4FB2-8D6F-06369C70BB4A/Library/Caches/AppLogs
    
    // Case 2, invalid format
    file://var/mobile/Containers/Data/Application/5FB2CD2D-91DC-4FB2-8D6F-06369C70BB4A/Library/Caches/AppLogs
    

    If the dataPath has a prefix, ex: file://, it is invalid.


    As for an instance of NSURL, path will return the string like case 1, and absolutePath will return the string like case 2.

提交回复
热议问题