Closed kentyunge closed 6 years ago
Thanks for the pr - I was looking at the issue you raised and started to investigate and this pr helped quite a bit. Now, there is an issue with the pr - if a user puts the files directly into the iOS project and references them directly (i.e. without the require
) than it would still take it as a valid url (as a path counts as a valid url as well) and would therefore not jump into the else statement where it should go. Another thing I found is that in some cases it doesn't properly load files from the file system when loading via NSUrl
. So, I've changed it all a bit to first check if the file is bundled, next check if it is found in the file system using the file manager and if both of these checks fail just attempt to load it via url. This should fix your as well as other use cases that previously failed. I've just pushed the fix under version 0.1.2
This pull request is in relationship to the following issue. https://github.com/reneweb/react-native-tensorflow/issues/12
I found the root of my problems were caused by in debug the path to the model, labels, or image files were
http://localhost...
while in release mode that changes tofile://....
. There are several if statements that check for a valid scheme and valid host which fails for thefile://...
location. I've removed those checks and it has fixed my issues. There may be a more robust way of handling these variances but I thought I would submit what I've found for now.