I require showing applications in the IOS device capable of opening various file formats.I tried using react native share to achieve the same but options of copying file to other apps did not appear.So i tried using react native fetch blob. RNFetchBlob.fs.exists(fs.dirs.DocumentDir+'/sample.pdf') return true , meaning the file does exist but when i use RNFetchBlob.ios.openDocument(fs.dirs.DocumentDir+'/sample.pdf') nothing happens, not even an error but rather the success callback is called. Appreciate any help.
I was able to resolve the issue , but i don't know why it actually happened in the first place. I used an Alert.alert to find if the file existed or not and then called the RNFetchBlob.ios.openDocument function, upon removing the alert just before the function call it started working.Posting this answer incase it does happen to anyone else.
Related
I am developing app where local files are stored in user phone's file system. When I try to check if file exists with
var info = await FileSystem.getInfoAsync(`${AppConstants.APP_FOLDER}/main.png`);
console.log(info.exists);
It will print true. But if I try to read contents of file after checking:
var content = await FileSystem.readAsStringAsync(`${AppConstants.TILE_FOLDER}/main.png`);
console.log(content.length);
It freezes and nothing will be printed. I've tested my app on IOS in Expo Go.
The filepath is like that: file:///var/mobile/Containers/Data/Application/.../app_folder/main.png
File system works properly with loading online files by url and images can be shown, while in my case they can't. How should I solve my problem? What additional data I need to provide? Thanks.
This isn't really an answer. But, I had something similar happen to me. You can't really trust console.log() to tell you what code is executing.
I was reading in a file and then processing the data within it. It appeared as if the FileSystem.readAsStringAsync() was hanging because my console.log() message that was directly after the FileSystem call was not being printed. But, it turned out that the problem was inside my processing code.
Once I focused on my processing code, I found the problem and corrected it. Perhaps this is what's happening in your case?
I'm implementing a WebDAV file server using the ITHit WebDave engine, i have the following problem
When i list the files and open one of them i get the ReadAsync method called, i provide the content and the file is opened correctly
However any changes i make to the file can't be saved, i get an error saying
A device attached to the system is not working
I looked at the file system samples and implemented support based on the FileSystemStorage.AspNetCore sample,
From what can understand the WriteAsync method is used when creating new files, should i expect for WriteAsync to also be called for file edits that need to be changed?
Am i wrong in the assumption that DavFile.WriteAsync will be called with a stream for the updated content?
If WriteAsync is not the right location to save updates to a file, could you provide some guidance on the process of saving changes to existing files?
Edited to add:
Now i can see that after i dismiss the first error about the device not working i get the standard save dialog box, if i click save it asks me if i want to overwrite the existing file, after accepting to overwrite then WriteAsync is called and i can update the file contents
I'm not quite sure why it would first tell me there's an error and then still allow me to write the file but only as replacement to the original file
Thanks for your help
Fixed, i found that there were issues with the ILockAsync implementation, reviewing the FileSystemStorage sample helped fix the issue with locking files before writing or updating properties
I am using Parse SDK as a backend and when application loading data from server i see label "Loading". But my app using another language and i wanna translate it. How can i fix it?
Image here
I am tried to change simulator language and and changing value of Localization native development region key in plist.
Anyone had this problem? I think there is very simple answer, but i cannot find it. :)
Thank you for help!
So after a long search, i discovered that you should create a file named "ParseUI.strings" in order to change UI elements like "Loading.." as you mentioned. You can see the file in the image below. You should use at least ParseUI framework 1.1.6 for this method.
After you create a file and named it as "ParseUI.strings" you can change UI elements which parse provides us. You can see which strings are editable here.
In your example you want to change "Loading..." string, so all you have to do is enter the code in your ParseUI.strings file.
"Loading..." = "Whatever thing you want to say...";
Thats it, it worked for me.
I preview docs in my app using a UIDocumentInteractionController. However, sometimes documents show fine, other times the interactioncontroller displays a message "Error while reading the document". I know it is not an issue with the document, because the same document sometimes shows and sometimes doesn't.
Restarting the device solves this problem temporarily - so it would appear to be a memory issue, but strangely I am not getting any memory warnings. Any ideas on how to get this to work reliably please?
Notes:
The documentinteractioncontroller preview is dismissed and the
controller released when finished to ensure prior previews do not
remain in memory
I had the same issue using the quicklook controller
After much testing it appears this issue is limited to iPad 1. The only workaround is a restart.
Since you believe that the document in question is correct, and you believe your code is correct, you have to start looking for other factors. Two that come to mind are:
The state of the application. Is there something about the current state of the app that could be preventing the preview from working? You mentioned that you don't get any memory warnings, but have you looked at how much memory the app is using when the preview succeeds and when it fails?
The state of the document. Is it possible that the file can't be opened for some reason, such as the file already being open? Can you open the file by any other means?
It's possible that your app is trying to display the doc before the os has finished writing it to the sandbox dir. The speed of this operation will be somewhat dependent on what else is going on the the background (other apps, email downloading, iOS checking for updates, etc.). This would also explain why restarting the device can seem to fix the problem temporarily.
To check this, you could check for this error and then try again to open the doc after a few seconds.
Without specific code or or logs, it's tough to say much more.
I am using appfile:/. The path is correct; if I put it on screen and copy-paste it in the explorer it links to the image.
Is there anything else I need to do?
UPDATED I have updated the library, now is more easy to use. Can you test it?
I am the author of the StageWebViewBridge class. There is a known problem if you are using Android. Anyway, I have a working solution I will update the next week.
If the problem is not in Android, then send me some code.
I am also confused on how to access locally packaged assets. I put them in the HTML folder as requested and when I send a signal to the StageWebViewBridge to set the .src attribute of a video I'm not sure how to do it.
Without StageWebViewBridge and entirely in a website I can just reference the file for a video object via JavaScript directly e.g. swvRef.src = 'file.mp4';. This works perfectly fine. When I try to tell flash to send a call via StageWebViewBridge it does receive the call to the StageWebView (I have JavaScript reporting it). However when I try to set the .src of a video object I can't figure out the correct path.
The documentation says to put all things in a 'html' folder. I did so. No reference to a .src of 'html/a.mp4' or 'a.mp4' or 'htmlCache/a.mp4' ever makes the new javascript html5 video class work.
Bridge otherwise is working perfectly sending AS->JS and JS->AS. I'm just looking for info on how to reference packaged files. I want to play a video I put in the /html folder and so far, I just can't do it.
Got the same issue and fixed it with "appfile:/"
Why do you require "appfile:/ for a local html file ?
If the treated html/js/css is local and asset is relative (aka ../ or no http://) you should treat them as "appfile:/" ?
If the treated file is distant you do not have to handle assets ?
Is there a best practice to work with "appfile:/" ?
Actually I debug my html/js/css game in the browser but if I use appfile:/ it will no longer works. I will have to handle 2 behaviors.