Document provider inconsistency - ios

I am using the new document provider functionality to try to export files to third party cloud services:
UIDocumentMenuViewController* activity = [[UIDocumentMenuViewController alloc] initWithURL:writer.file
inMode:UIDocumentPickerModeExportToService];
When I run this, I see iCloud, Google Drive and Dropbox as an option (and they appear to work). What I don't see, even though I have the app installed, is Box.
What's more odd is that when I use UIDocumentPickerModeOpen, Box does appear, along with iCloud, but Dropbox and Google Drive are missing. I can't open the file from either provider, though; it won't let me select my custom document type. In another app where I just export a CSV file is seems to work without issue to all providers.
The file uses a custom file type, which I'm guessing is part of the problem. There are other questions here about that and I believe I've correctly followed the instructions.
Did I miss a step when adding a the custom file type? Are there other options when creating the document menu? Are there bugs in the document providers? (I note that it works in all cases with iCloud Drive.)

At this moment only iCloud Drive supports all four modes: import, export, open and move. Dropbox and Google Drive don't support open. Box does support open. I don't think there is much we developers can do except waiting for all the cloud providers to support all modes.
I am also using a custom UTI, and this setting is working for me. I can select a .qvlibrary file from iCloud Drive, and open it with a security-scoped URL. Remember to call -[NSURL startAccessingSecurityScopedResource] before accessing the files or directories.

Related

Document Renaming with UIDocumentBrowserViewController

I am using the "new way" of storing documents (iOS 11+) using UIDocumentBrowserViewController. No need for iCloud API, Entitlements etc. -- just works (under control of the separate Document Browser process).
However, I haven't figured out how to rename (i.e. move) a document programmatically this way, at least within iCloud. The standard "url.setResourceValues()" does work just fine on the local filesystem, but renders in 513/not permitted in iCloud. Also all the former ways of doing it (using full set of iCloud capabilities & entitlements, using complex FileCoordinator orchestration etc.) don't work either when the created document actually is controlled through the document browser.
I couldn't find any reasonable documentation or example on how to use the UIDocumentBrowser to also move a document under it's (and somewhat my) control. There is the UIDocumentBrowserImportModeMove mode that might do what I need, however I have no clue how to programmatically initiate that on a given UIDocument.
Has anyone already made experiences to do it this way?
Thanks, habitoti
There is no API to move a document that was returned to you by the document browser after the user picked it. You should file a bug with Apple to get one.
If this is inside your iCloud container, you can use the iCloud entitlements and -[NSFileManager URLForUbiquityContainerIdentifier:] to get sandbox access to your container and do whatever you want inside with NSFileManager; but that won't work in iCloud outside of your container or in other file providers (Dropbox...).

Define file association in Mac with Electron

I am trying to create a simple electron app, that opens Google office files from Google Drive, reads the link file and creates a new window containing that google doc page.
I can make it work, if I edit info.plist after building with electron-builder to make the app accept the file extensions '.gdoc, .gsheets and .gslides'.
Is there a smarter way that doesn't involve manually editing info.plist?
Electron-builder is supposed to be able to do that through specifying the FileAssociation. I've read of various issues with this but haven't needed it myself yet– if it works for you, please report back.
There is also the Windows only electron-regedit node module:
"File associations, file icons & open with... for electron apps
This module allows you to register your app in the windows registry,
manipulate context menus & handle native open, edit, print, preview
actions ect."
However for Google drive you might be looking at registering a protocol and url scheme. There is support for that electron-packager
protocol
Array of Strings
The URL protocol scheme(s) to associate the app with. For example,
specifying myapp would cause URLs such as myapp://path to be opened
with the app. Maps to the CFBundleURLSchemes metadata property. This
option requires a corresponding protocol-name option to be specified.
protocol-name
Array of Strings
The descriptive name(s) of the URL protocol scheme(s) specified via
the protocol option. Maps to the CFBundleURLName metadata property.

UIDocumentPickerViewController Limitations, Multiple Files selection at once

In order to be able to access iCloud Drive from the application,
I think that we want to use UIDocumentPickerViewController from the application.
but i found following problems when i use UIDocumentPickerViewController.
Cannot upload multiple files at once.
Cannot Download multiple files at once.
When pushViewController from navigationController then display
become strange.
I want to avoid above problems, So is there any another way to get files information from iCloudDrive without using UIDocumentPickerViewController?
like Send some request or query.
I have searched lot and didn't find any query or request to get Files ,Upload files and download files from iCloudDrive.
if you have any idea about this please tell me.
Thanks,
I don't think there's any straightforward alternative, but you could think of...
...using iCloud directly (not iCloud Drive), but then users will only have access to their files from your application
...using Google Drive's sharing extension which supports uploading multiple files at once (the Dropbox SDK probably supports that, too, but their sharing extension doesn't)
...zipping all files before uploading them
...changing the file format so that it's a bundle of multiple files, if you are in control of the file format
...file a radar/feature request, and possibly wait forever ;)
Not sure if that helps, but I don't think you have much of a choice here.

How to use Google Drive in a Java Desktop app?

I am dealing with mobile and desktop applications. I am trying to use Google Drive as a permanent storage folder. Unfortunately I am at a loss because I cannot find any examples. Can someone point me at an example of storing or retrieving a file from Google Drive?
I would really like to see a simple example in code or maybe a library which can handle this. I am stuck at Retrieve and Use OAuth 2.0 Credentials https://developers.google.com/drive/credentials
Did you look at the sample app on the drive API page?
edit
google moved the examples to github
I don't know if I figured out your problem. What I have understood is that you are looking for a way that makes you able to work on the same project from different computers.
If so, you simply have to download Drive. Once install it will ask you what folder you want to keep syncronized with Drive. If you select your workspace, it will be syncronized with Drive. So, on another pc, if you have installed Drive, you will be able to use the workspace folder too, with the same files.
I hope this is helpful.
Marco
You should look into Documents List API.
The Google Drive API & SDK are meant to be a mean to integrate applications into the Web-UI of Google Drive. To protect the security of the user's files, it puts some restrictions to the application developer, like:
The app has to be installed from the Chrome Web Store
The app can only access files created from the app itself,
or files selected by the user using the Google Picker UI.
All these restrictions make the Google Drive API not a good choice for most non-web applications.
E.g. installing the app from the Chrome Web Store is probably something you would find cumbersome to request from your users for a mobile or desktop application. Nonetheless, without being installed from the Chrome Web Store your application will always receive an error when accessing a file from Google Drive.
The Documents List API allows you to store and load files (not only Google Documents!) into Google Drive.
This question is a little bit old, still. You can look at this example: https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2
They do the OAuth2 for accessing task. But I just used the same code to access the files using the v2 API. http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Drive_API
I only retrieved the file list, but it is working (from .NET, desktop app).

Open a file that is on a file server from a webpage?

I am working on an internal application. We have a website that displays all our SSRS reports for a group of work. I have been asked to see if I can link all the files (pdf, word, excel) for the group of work. These files are stored on a file server that users viewing the reports have access to. Each group has its own group of reports and shared files.
Is it possible to open the files (without downloading them) from a webpage? Meaning that they file is opened from the file server? I don't want people to download a copy of the file.
I am pretty sure this can work with IE because sharepoint does it. However, other browsers may have an issue.
EDIT: What I would like is to have a web page with links to the files. When they click on a link (say for a word doc), word will open the file that resides on the file server. Without out a local copy downloaded from the network share.
EDIT2: Please note, I know what I am asking is probably not possible in all browsers. I am more or less just making sure. It seems possible in IE using activeX, but out side of that browsers do a good job at keeping processes inside a sandbox.
3 options. Remember this is for an internal website.
link to the share using file://. This will have the side affect of downloading the file to be viewed. As long as user clicks open every time it should not be a big deal.
Use JavaScript and activeX to open word (excel, reader, ect) passing in the file path as a command line arguments. This works only in IE and in win7 (probably vista) user will get a pop up asking if it is ok for the activeX control to run.
Create a new protocol. openfile://. This would be set up to run an application that is installed on the client machine which would open the file. Since it is internal, the application could be installed on the machines without issues. This also requires a registry change.
I haven't picked one as this change is still being looked into but i figure I would update this in case someone runs into something similar.

Resources