Unable to access all files in iOS using cordova - ios

Im using
window.resolveLocalFileSystemURL(cordova.file.dataDirectory,function(root){},err);
But I'm unable to get all the files. Camera files are also not accessible.
How to resolve ?

In iOS, we cannot access the all files using cordova file plugin whereas Android has support for accessing files form externalRootDirectory. Specific to iOS its better to use imagePicker, audioPicker plugins to access camera files.

Related

how to save file from an iOS react native app to Files folder

I created a pdf file in my react native app for iOS devices, and also I can open the file in my application because it saved in Documents directory of internal storage of my application, but I want to save the file to Files folder in iOS and open it with other applications, how can I do it?
thank for your attention.
For IOS you should open share options and save the file to the Files folder. For this you can use 'react-native-share' library. If you are using Expo, use 'expo-share'. Please check below documentation.
https://www.npmjs.com/package/react-native-sharing
https://docs.expo.dev/versions/latest/sdk/sharing/

Embed Cordova-Webview and Plugin

I'm trying to embed Cordova in my native iOS application. I only need a tiny part of my application to use cordova. From now I managed to show a CordovaViewController with some HTML in there, but I can't find out how to add cordova plugins (ex. cordova-plugin-network-information) in the project.
I installed it using cocoapods, but I can't find in the Cordova's documentation how to wire it up with my www folder so that navigator.connection would not be undefined
Thank you for your help!

how to add plugin without cli in cordova 3.5.0 iOS

I am not using cli for my cordova project ,i got the cordova 3.5.0 project from there site and integrated with my project.All the custom plugins created by me is working fine.But the API's like device is not accessible.I have added the CDVDevice to config.xml but still i can't able to access the device object.
So please help me to solve this problem.
In order to correctly working the Cordova requires you to have cordova_plugins.js file near the cordova.js. That file contains registration of the JS API.
The easiest part is use Plugman to install plugins inside your custom project, that way, it will handle all work on creation of cordova_plugins.js.
Official Cordova documentation for the Plugman
See the possible related answer Cordova 3.5 embedded webview with plugins where I put more insights about how you could modify cordova_plugins.js in case you desperately need this, but I would recommend you to use Plugman.

Phonegap working with Android but not with iOS, Error Code

I am getting this error code when i open a phonegap html site in iOS:
gap:["Device","getDeviceInfo","Device341875241"]
gap:["NetworkStatus","getConnectionInfo","NetworkStatus341875242"]
gap:["App","show","App341875243"]
It is working with Android perfectly.. i am using cordova 2.7.0.
What´s that supposed to mean?
thanks!
You must add the correct cordova-2.7.0.js file that is specific to iOS. This error usually occurs when you add cordova JS file which is not specific to a particular platform. In other words, you should add the iOS specific cordova-2.7.0 JS file to your iOS PhoneGap project.
Possible scenario:
You might have wrongly included the Android specific cordova-2.7.0 JS file in your iOS project.
Fix:
Just remove the current cordova JS file and add the cordova-2.7.0.js file from iOS folder in the downloaded Phonegap-2.7.0 folder

Can I deploy Cocoa http server with my phonegap/cordova IOS app

I have an IOS app built with phonegap/cordova 2.1.0 and I would like to use a cocoahttpserver running with the app so that encrypted locally stored video can be streamed from the cocoahttpserver to the app.
This may seem like overkill and please advise me if it is but the reason I want to do this is so that I can stream encrypted segmented video which has been prepared using Apple's mediafilesegmenter and which is locally stored on the device.
I have already tried to play the encrypted video by using a video tag to call the .m3u8 file but this only works over http and not from the local filesystem.
Could you please point me in the right direction to deploy the cocoahttpserver with my app.
Many thanks
I have now successfully integrated phonegap/cordova and cocoahttpserver into one ios App. These were the steps:
1) place the cocoahttpserver project in the phonegap project, for example in Externals/cocoahttpserver and keep the whole project there so it can be easily updated from the master repository at a later date if needed.
2) Open the phonegap project in Xcode and add the Externals directory to the header search paths by clicking on the phonegap project target, and adding 'Externals' as a recursive path in 'Header Search Paths'
3) In the target build phases for the phonegap app add all needed .m files from cocoahttpserver in 'Compile Sources'. These are all the files in Core, Vendor and Samples/iPhoneHTTPServer. Do not add iPhoneHTTPServerAppDelegate.m or iPhoneHTTPServerViewController.m
4) By looking at the iPhoneHTTPServerAppDelegate.m and the phonegap AppDelegate.m side by side try to merge the two together so that the server is instantiated in phonegap's AppDelegate.m Do not instantiate a iPhoneHTTPServerViewController.m as you won't need this blank view. Also I had to include standard Libraries libxml2.dlyb and Security.framework to my phonegap build phases
5) In your AppDelegate.m you can set the server web path to any directory you like. Make sure this directory is copied on build
Hope this helps someone :)

Resources