Reputation: 1331
I've added UIFileSharingEnabled to the .plist. Per suggestions, I have:
Which added UIFileSharingEnabled to the .plist But it has no effect to application .
Edit:
I am trying to use cordova-plugin-itunesfilesharing
I added these <key>UIFileSharingEnabled</key> <true/>
in my .plist file. I need to turn on itunes file sharing in my ios application.
Upvotes: 1
Views: 1176
Reputation: 443
In addition to using cordova-plugin-itunesfilesharing
, you also need to put your files in the app's Documents directory to make them visible via iTunes. I'm assuming you're using cordova-plugin-file
for the actual file writing. In this case, cordova.file.documentsDirectory
will point to the Documents folder on iOS.
Example:
var isAppend = true;
window.resolveLocalFileSystemURL(cordova.file.documentsDirectory, function (dir) {
dir.getFile("my_file_name.txt", {create: true}, function (fileEntry) {
fileEntry.createWriter(function (fileWriter) {
fileWriter.onerror = function (e) {
console.log("Failed writing to file: " + e.message);
};
// If we are appending data to file, go to the end of the file.
if (isAppend) {
try {
console.log("isAppend = TRUE, seeking log file end");
fileWriter.seek(fileWriter.length);
}
catch (e) {
console.log("Failed seeking end of file: " + e.message);
}
}
fileWriter.write(contentToBeWritten);
}
);
});
});
Upvotes: 1