iOS App's file associations ("open with..") / CFBundleDocumentTypes question - ios

I have recently bought a perfect file manager app for my iPad. Everything in this app is great, besides that it cannot handle some specific file types.
So for example if I try to download the file in mobile safari and try to save it into the file manager (for further upload to dropbox, email and so on), I cannot do this because the app is not listed in the "open In" list.
The question is, how to associate this app with this specific file types? I've searched google and found out that app's file association information is stored in Info.plist file in the CFBundleDocumentTypes section.
So I just modified Info.plist but id didn't help. I also found the cracked version of this app and placed info.plist into the IPA file, reinstalled the app on the iPad and it also didn't help.
Any suggestions how to solve the problem?

You cannot just add the file types. The app also has to be coded to accept the request to open the file.
Try contacting the developer and ask for them to add this feature.

The problem is probably not the APP but a limitation on IOS: it is a random selection and only shows 10. I don't know if it randomly selects based on the ones you use most or what. You cannot change this other than to delete apps you don't use as often. But having said this, the app must also support the extension of the document you are trying to send: not just as a document it stores, but as a document it accepts as a transfer from another app. You can try to convert it first into a PDF and then open, if that's possible. Hope this helps.

Related

App Store Connect Warns - Invalid Document Configuration

I have submitted a Single View Swift iOS application to App Store Connect. The application is not Document Based.
The application uploads successfully, but I get the following warning in an email from Apple. I can still test the application through Test Flight, but I want to eliminate the warning.
"Invalid Document Configuration - Document Based Apps should support either the Document Browser (UISupportsDocumentBrowser = YES) or implement Open In Place (LSSupportsOpeningDocumentsInPlace = YES/NO)."
I just ran into the same problem; I don't know why, since I barely change anything since the previous version of my app.
Anyway, my app doesn't support the Document Browser, so the first half of the error message doesn't apply. That left me with the second half. I looked up LSSupportsOpeningDocumentsInPlace's documentation and still wasn't clear on how it works, so I decided to try both options. My app supports it's own document type, and when a user opens an appropriate file iOS shows an action sheet with the option "Copy to Leio" (my app). After setting LSSupportsOpeningDocumentsInPlace to YES, iOS wouldn't show that action sheet anymore; it would just open my app and do nothing. So I set it to NO; now the app works as it did before and I'm not getting that error message anymore. If you don't handle any document types I suppose you could set the option either way.
Edit: There's some more information about that option here.
So there you go. If your app were to edit a document, would it edit the original document, or would it make a copy and deal with that? Set the option accordingly. If you really don't do anything like that I'd guess setting the option to NO would be the safest bet, and I think that's how my app behaved when I hadn't set that option at all.
Since your app is not Document based just set UISupportsDocumentBrowser and/or LSSupportsOpeningDocumentsInPlace (reference and documentation) to NO in your plist. This should resolve the warning.
I had the same problem with the warning from App Store Connect. After changes these two keys to NO and resubmitting the warning was gone.
Typical Requirement
If your application is not document based (which would typically be the case if you get this new warning) and if furthermore you are already opening files in your documents directory, then all you need is:
LSSupportsOpeningDocumentsInPlace = YES
This answer does not apply if you are not opening documents in place (i.e. make a copy), or of course, if you so desire to support document browser, as seen in #rivera's comment.
If you are using UIDocumentInteractionController in your app, set
UISupportsDocumentBrowser = YES
in your project's info.plist; otherwise, set
UISupportsDocumentBrowser = NO
It appears that if you have CFBundleDocumentTypes in your apps Info.plist, even if the array is empty, this warning is triggered when you submit your app. If your app doesn't support any document types remove that key and you won't get the warning.
I also faced the same issue recently while uploading the app to TestFlight, The below solution worked for me,
In your app's Info.plist file, the UISupportsDocumentBrowser key is set to YES, declaring document browser support for your app.
For more info, please refer Setting Up a Document Browser App
Here are where you find the settings in Xcode 13:

Create a file through a Cordova/Phonegap app that can be opened by another app (ios)?

I'm able to create and save files using cordova-plugin-file, and have been saving and accessing them from within the app to cordova.file.documentsDirectory.
The problem it seems is that all the directories that one can save to are private, Cordova-plugin-file documentation
I would like to be able to have these files saved in (or moved to) the ios blue "files" folder, so that they can be opened by other apps such as Numbers, Pages, etc. It seems so simple there has to be a way to do this, but I can't find it after more than a few evenings of searching and trying different ways.
I'd be grateful if someone could point me in the right direction.
From what I can tell you can save to the documents directory "cordova.file.documentsDirectory". By default this directory is shared with iCloud, so a file saved here could be opened through the ios File folder and a user could then select the files and hit the share icon to open with the appropriate app, such as Numbers etc.
In order to turn on iCloud you have to pay the developer fee to Apple and select the options to do so. I found the article "Working with the Files App in iOS 11" to be helpful in starting this process.
I don't have the paid developer account yet, but from what I'm reading it should work once I activate one. I'm open to a better solution or critique.

How to put file manually to iOS persistentDataPath?

{to the point}
So I want to create some Quiz Game on Unity that the questions data using external file (in this case I using JSON). I want to keep my questions data can access/edit by myself separately. And then I just have to copy-paste it manually to persistentDataPath in iOS but I don't know how to do it. Anyone can help me?
Note : I don't wanna use any script/code to do it, just manually Copy-Paste it...\
thank you,
You need to set "Application Supports iTunes file sharing" key in the info plist of your app in Xcode.
...and then you can access persistentDataPath through iTunes.
(In the example screenshot below I copied midi.csv from my MacBook to excel in my iPad)
To make it more comfy add a PostProcessBuild-script like this one (gist).
It applies the setting after each build, so no manual steps.

Has SugarWod (iOS) implemented a Custom Url?

I'm specifically looking to see if SugarWod has implemented a Custom Url, and if so, what it is. They have no developer documentation available and their support has yet to respond back.
If that's unknown, is there a list of sites that currently implement a Custom Url, so that another iOS app can open it?
Or is there a way to see find the Custom Url of an app, if it exists, from your device, iTunes, etc?
Thanks a lot.
It supports a custom URL which starts with sugarwod://
You can easily find this out for any app you have the IPA file of.
1. Rename the extension of the app from .ipa to .zip
2. Extract the zip file
3. Go to the Payload folder of the app
4. Right click on the single file there and choose "show package contents"
5. Open the Info.plist in Xcode and look for the URL types
If there are supported URL's, they can be found there.

Writing to a file in my iOS app

I have an app that downloads files that need to be edited and submitted back to the server through the app. These files could be anything, but are most likely to be .docs. I want to be able to open and edit these files in another app on the device, such as a .doc editor.
I've been able to get this functionality to work in similar Android and Chrome apps, but I'm very new to iOS so I'm not sure what my options are.
Is there a way to give permission for another app to edit a file that is in my app's sandbox? If not, is there a way to get the file back for submittal (like finding it through a file explorer launched through my app - similar to an 'Open..." file explorer dialog used in Windows/Mac OS/Chrome)? Am I going to have to create a way for the editor app to share the edited file back to my app?
Thanks in advance for your help!
To manage the file and the paths take a look at the documentation for NSFileManager:
https://developer.apple.com/LIBRARY/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
I usually write using NSFileHandle for reading and writing:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
Hope this helps.
iOS8 will provide methods to allow apps to co-operate with "extensions".
See "Creating Extensions for iOS and OS X, Part 1 & 2` in the WWDC14 videos.
Also see the Apple "App Extension Programming Guide".
I ended up sending the file to a 3rd party app for editing and then sending the file back from the 3rd app to my app.

Resources