Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil always returned when ios source file path begins with "/" #14

Open
sebringj opened this issue Jun 27, 2016 · 3 comments
Open

nil always returned when ios source file path begins with "/" #14

sebringj opened this issue Jun 27, 2016 · 3 comments

Comments

@sebringj
Copy link

sebringj commented Jun 27, 2016

Within obtainURLForPath
NSString *pathForResource = [self.commandDelegate pathForResource:path];

always is nil
prepending "file://" or using "cdvfile://" to the path prior to calling this code will enable it to work as it skips this part.

tested on iphone 6s plus

@sebringj sebringj changed the title ios source file path begins with "/" and not "file://" returns nil nil always returned when ios source file path begins with "/" Jun 27, 2016
@kerrishotts
Copy link
Member

So, when not providing a uri scheme, the current expectation is that you want to load a file from the application bundle. As such, "file://" is not the assumed scheme; it must be explicitly declared. (As a consequence, "/path/to/file" and "file:///path/to/file" mean very different things -- the first is relative to the app's bundle and the latter is relative to the system root.)

If you are having a problem loading an asset from within the app bundle, please post some code that replicates the problem.

@sebringj
Copy link
Author

Thanks, Kerri, for making this. The reason this is filed as a bug is because the previous behavior of this code base allowed for this to work. Once I updated this plugin, I found it not working as before and adding the "file://" in front allowed it to work as I expected.

@jacobo3d
Copy link

Hi, I'm having the same issue. Prepending file:// or cdvfile:// works on iOS, but it doesn't seem to be working on Android. It gives a file not found error, on that path. Any ideas? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants