How can we check if a file is present in the external bundle loaded in the app or not before fetching it?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
To check if a file exists in the bundle, use the
NSBundle
class.Having said that however, it's typically a bad idea to check if a file exists first before trying to load it. According to the Apple docs on
NSFileManager fileExistsAtPath:
If you only want to know if it's there so you can decide whether to load it or not, I'd just attempt to load it and check if the object returned is nil. If it is, you know it doesnt exist in the bundle.