Testing file existence using NSURL

前端 未结 6 2062
失恋的感觉
失恋的感觉 2020-12-07 20:10

Snow Leopard introduced many new methods to use NSURL objects to refer to files, not pathnames or Core Services\' FSRefs.

However, there\'s one task I can\'t find a

6条回答
  •  自闭症患者
    2020-12-07 20:32

    On iOS I couldn't find any other way...

    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"file.type"];
    if ([[NSFileManager defaultManager] fileExistsAtPath:[storeURL path]]) {...}
    

提交回复
热议问题