Image download but can't open show photos can't open this file because the format is currently unsupported or the file is corrupted - url

This my code
When i run this code it's download the image success but doesn't open

Related

React native: Display image in TestFlight not working

I have app who I had uploaded to Testflight, Almost everything works fine, but there is one Image who not displays. This image is inside my IOS folder and displayed as a background Image in the package "RNSketchCanvas".
If run my App one the simulator it works perfect.
Here is the following code who I use to display the image:
localSourceImage={{
filename:
'/Users/username/Desktop/ProjectName/iOS/image.png',
mode: 'AspectFit',
directory: 'SketchCanvas.MAIN_BUNDLE',
}}
Could it be the "PNG" format who is the problem or that I have to put the image inside "images.xcassets" or something else?
Like the documentation states here:
https://github.com/terrylinla/react-native-sketch-canvas#background-image
you need to add the image to your native project. You should not even add it to an xcassets folder but just as a plain image file to your native App bundle. After that you can use it with the filename and directory to RNSketchCanvas.MAIN_BUNDLE. On Android you have to add it to resources.

How can I download files from 'react-native' or 'Expo' to 'icloud drive'?

I am trying to create a file and download it to the device directory.
I use react-native-fetch-blob Also I was usedreact-native-fs
It is easy to download from Android and can check and read files directly from the actual device.
The file I'm talking about is a string file made of json, not a picture or video.
The directory path I use in Android:
const dirs = RNFetchBlob.fs.dirs
dirs.DownloadDir
...
RNFetchBlob.fs
.writeFile(path, data, "utf8")
.then(success => {
console.log("FILE WRITTEN!");
})
.catch(err => {
console.log(err.message);
});
But the problem is the iPhone. I have already checked the cloud documents and CloudKit through the developer account in Xcode.
Although it succeeded in using dirs.DocumentDir to execute the download, it ran the file app from the actual device and tried to go inside by clicking on icloud drive but the file was not visible, just empty.
How can I download to Icloud Drive?
Also How do I create a file from 'react-native' to 'On my iPhone' as shown in the picture below?

How to get .apk file's icon in ios?

For now, I can read a .apk file from sandbox in my iOS Project, but I want to show more detailed information about this Android package file, like the package name or icon in UITableView. How can I access this information to make my model?
.apk file is a zip archive and its manifest file will be in binary format. If you extract the apk file and read its manifest file from binary format, you can read package information, permissions and icon name(which will be located in drawable folder).
In Android platform, there are API's to read package information of apk files. In IOS they are not available.

Save file to public directory in iOS using cordova

I have a cordova application that downloads pdf file from internet and save it to local filesystem using cordova-plugin-file and cordova-plugin-file-transfer. In next step I would like to open the file using default application for specified mimetype. I am using cordova-plugin-file-opener2 plugin for that. Directory where the file is saved needs to be readable for chosen 3rd party application to open the file. On android there are several publicly accessible filesystem directories and I have it working correctly. But I am unable to find the right directory where I need to save the file in case of iOS, to make it available for chosen default 3rd party app.
cordova-plugin-file says in its docs that all directories available in RW mode to cordova application are private: https://github.com/apache/cordova-plugin-file#file-system-layouts
But how does it come? Concept of opening file by default 3rd party application based on mimetype is standard in every OS. Any help would be appreciated.
iOS hasn't publicly accessible filesystem directories.
One way - use sharing via UIActivityViewController.
I am using cordova-plugin-file-opener2 plugin with IOS. I save my file in cordova.file.cacheDirectory and this works fine for me when I save a zip file into that location. I first had to install a zip file manager so to handle the mimeType = application/zip. The zip file manager I used was a free version of "Zip Viewer" which seems ok but has a few ads.
To get it to work on Android I had to save my file in
cordova.file.externalRootDirectory it failed silently when I used cordova.file.cacheDirectory for Android. You can't use cordova.file.externalRootDirectory for IOS because it is not defined for IOS according to the Cordova File Plugin docs.
Here is a code snippet that is called when the file is saved:
var fileName = "myfile.zip";
//for IOS
var filePath = cordova.file.cacheDirectory+"/Download/"+fileName;
//for Android
//var filePath = cordova.file.externalRootDirectory+"/Download/"+fileName;
var mimeType = "application/zip";
cordova.plugins.fileOpener2.open(
filePath,
mimeType,
{error : function(){
my.alert("ERROR opening with cordova.plugins.fileOpener2");
},
success : function(){
my.log("SUCCESS opening zip file");
}
});

Find downloaded file from cordova-plugin-file-transfer

Using cordova-plugin-file-transfer I'm able to download files. But how can I access those files outside the application? It's a pdf. I open the iBook app but I can't find the file I just finished downloading. I believe it has something to do with the download path.
Can someone help me figure this out?
This is what I've done to download the file: Cordova / Ionic - Download file from InAppBrowser
Thank you :]

Resources