iOS application base path

2019-02-19 23:25发布

I am currently developing an application using Phonegap / Jekyll / Backbone. I am however in the need for a base path for my generation of static content. For Android platforms I use /android_asset/www/ which is working fine. I am however unable to find one for iOS, anyone has any idea about it?

Thanks in advance.

1条回答
等我变得足够好
2楼-- · 2019-02-19 23:50

You have to asynchronously ask the iOS device to give you the root path. In deviceready function call:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFS, null);

When ready it will callback with a FileSystem object from which you can access the full root path.

function onFS(fs) {
    alert(fs.root.fullPath); 
}

Read more on PhoneGap/Cordova docs: http://docs.phonegap.com/en/edge/cordova_file_file.md.html#FileSystem

查看更多
登录 后发表回答