I just started to test my Phonegap application on iOS Simulator but I've got some problems:
First thing I did was getting the root path:
requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onError);
So I get something like this: Users/christophe/Library/Application Support/iPhone Simulator/5.1/Applications/CODE/Documents
Then I just figured out that I need to add file:// before this path to use the resolveLocalFileSystemURI() otherwise the file is not found.
So I tested my Download function like this:
download(url, "file://"+root+"folder/siteList.xml", callbacks)
But I got an error telling me that the filePath or the URL is wrong. So, I checked the URL: no problem.
The problem comes from the FilePath.
The "folder" I added blocked the download.
If I download the file in the root folder:
download(url, "file://"+root+"/siteList.xml", callbacks);.
It worked.
How can I download in an other folder ?
I already tried this on Android. There's no such problem.
Thank you
Related
In my flutter iOS app, every time the app is launched, it would call PathProvider.getApplicationDocumentsDirectory() to get the app documents directory to access to the previously saved data. If I install the app on an iOS device(not update here), the app could work exactly as expected. But if I updated the app from Apple Store or from Xcode, the app cannot longer be launched successfully. When I try to debug, I found the app caught exceptions at working with the drectory returned by PathProvider.getApplicationDocumentsDirectory(). Anybody could give some suggestions for fixing this? Thanks in advance.
For more information, when launched, my app has to execute createSync(recursive=true) if it does not find some app documents directories where I would store user-generated data. The app documents directories are returned by PathProvider.getApplicationDocumentsDirectory. However, after I updated the app, and when launched the app, PathProvider.getApplicationDocumentsDirectory() could still return a directory which has appropriate pattern, but the returned directory may not be the right directory since my app failed to find previously created folders there, so the app had to create the relevant directory for storing user-generated data again, and then I always got the error as below
FileSystemException: Creation failed (OS Error: Operation not permitted, errno = 1)
when I tried to create the directory with createSync(recursive=true), and no matter the version of path_provider was 1.20 or 1.10, the phenomenon persisted. Please help.
I assume the error you got is both happened in iOS simulator & iOS device ?
Get the path
Would you mind try to run on iOS simulator, and print out the path of the folder you try to access.
Open the folder in Finder
And with the printed folder path, you can open the folder with Finder by Cmd + G.
The error
Your mentioned error usually is because accessing the folder not belong to the app.
Let's see more after you print out the folder path.
A project was working normally, but after i updated xcode to its latest version, i began having this error everytime i want to run the project on a real device :
The file could not be opened becuase you dont have permission to view it.
i tried all the solutions in this link: Error while build project xcode says : "you don't have permission"
but nothing worked, and the error is still there.
any idea what happened?
thanks
If the project you download from the internet don't have the Executable file can make this.Last time ,I use the fllow method to solve it.
Open info.plist
Check the key "Executable file"'s value,its value should be this ${EXECUTABLE_NAME}.
clean->build->run
So when i changed it ${EXECUTABLE_NAME} this value then successfully.
I'm having a project with Non-ARC,now I migrated the application Xcode 6 with SDK 8.1 after succesful migration, when I tried to archive it the *.ipa file got created but if I tried to upload the app via diawi or hokey app the it shows a issue
Say In Diawi it shows
No professional profile found
I tried changing it to .zip & extracted the zip there I found out instead of creating PayLoad directory it shows me Applications directory ,From that I came to know there is no Payload directory created that is the issue .
Kindly help me in this , Why Payload directory not been created ?
I just to add a script for creating Payload directory but that not worked for me.
To correct it, I need to edit the Info.plist file to set:
Application requires iPhone environment = YES
I'm developing a PhoneGap application where the user is able to navigate some pages served by a server. When the user navigates to those pages, the app downloads all the files (HTML, CSS, JS, etc.) and store them in the iPad. This way, if the user tries to access those pages being offline, the local files are served.
This app worked fine in iOS 7. Yesterday I decided to update my iPad to iOS 8, and at first it seemed it worked: I can download the files, go offline and still navigate the pages using the local files. The only error I'm getting in the Console is:
[Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object.
The problem comes when I update my app or use "phonegap local run ios" with the app installed. Whenever I do it, the app becomes unable to load the local files:
Failed to load resource: The requested URL was not found on this server.
file:///var/mobile/Containers/Data/Application/7A3590E8-C78A-4F45-B5B9-51FD0BAFE524/Library/files/pages/7/7a56ab3cfa56fbd1b9c4becbf5dca4a2.jpg
The files are there, I can read them using the File plugin, but the WebView is unable to load them. I'm referencing them like this:
<img src="file://localhost/var/mobile/Containers/Data/Application/7A3590E8-C78A-4F45-B5B9-51FD0BAFE524/Library/files/pages/7/7a56ab3cfa56fbd1b9c4becbf5dca4a2.jpg" >
I tried to use both Library and Compatibility as iosPersistentFileLocation, but the result is the same. I'm marking all the downloaded files as "don't backup" to prevent them being included in iCloud:
fileEntry.setMetadata(function(){}, function(){}, {"com.apple.MobileBackup": 1});
At first I thought this was caused by the known bug to load local files in iOS 8, but my app IS loading them, it just stops working after I update the app.
I have PhoneGap and all the plugins updated to the last version. I also tried using Cordova and the same happens.
Anybody knows how can I solve this or where should I report this bug?
Thank you!
I managed to solve it! I was using fileEntry.toURL to get the file URLs to use in my HTML. If I use
fileEntry.toInternalURL()
instead, it works fine.
With internal URL the URLs are like this:
cdvfile://localhost/persistent/pages/7/0b0cc746c5e90ee7fc94b2c15d37d43e.png
I ran into the same problem and I managed to solve it. In my case, my problem was that every time I update the app, the new app has a different id than the last one. For instance, the path for the older app was:
file:///var/mobile/Containers/Data/Application/7A3590E8-C78A-4F45-B5B9-51FD0BAFE524/Library/files/file.pdf
And new one:
file:///var/mobile/Containers/Data/Application/1BC5FS-7B3B-90E8-C7C8-1B7C1984C2A71/Library/files/file.pdf
So even though my pdf files were still on the application data storage, I was using the wrong path since the app created a new application id. I solved this by creating a new function that updates my path every time there is an update. I find the application id by using:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
function onFileSystemSuccess(fileSystem) {
//Do what you need here
}
The filesystem is an object contains the nativeURL inside the root.
Hope it helps!
I have created a small IPhone Application with PhoneGap (1.5), and I would now like to test it on my device.
I have set the output to my IPhone, and clicked build. The application is added, but I receive the following error when trying to run it on the phone:
ERROR: Start Page at 'www/index.html' was not found.
It works fine if I try it on the simulator, so what might I have forgotten?
I guess you could try to remove your www folder from your project and try to re-add it this way
PhoneGap application: "ERROR: Start Page at `www/index.html` was not found"
Hope it helps
I found out that there might have been an issue when I set up the application in the first place. First of all I saw that I referenced to an older version (1.4) of PhoneGap. I downloaded the newer version of the javascript component and replaced it, but it didn't help.
I then simply just created a new solution an copied the code from my old project and then it worked.
I am sorry to say that I don't know excately what went wrong.