Adding file extensions to iOS document manager - ios

I’m using the default iOS file manager for a Swift application. I’m writing the class for a UIDocumentBrowserViewController and I want the whole file name to show. For example rather than Untitled, I want Untitled.txt. Or rather than script, script.py.
As a side note, I notice that the actual files app does not have functionality to show the extension.

Sometimes its worth to check apple documentation) https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller
As I see it is possible to show file's extension, with help of var shouldShowFileExtensions: Bool from UIDocumentBrowserViewController. But to our sorrow it's available only from iOS 13.0+.
And as Apple says about this property https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller/3153159-shouldshowfileextensions
The default value is false.
This property has no effect in iPad apps running in macOS.

Related

Xcode Playground Microphone Permissions within Packages

I'm working on an iOS Swift Package/framework and we have a simple microphone input class that will assign the microphone input level to a variable to control visuals.
The class works fine when I use the class in a traditional app. The simulator properly asks for permissions, as does the actual iPhone. It does this through the info.plists file which is properly configured with the microphone privacy setting and explanation string.
As a part of the framework, we are also including Xcode Playgrounds within the package as a set of tutorials. I am trying to create a microphone example. Because the playgrounds are inside of a Swift Package/framework, I'm unsure if it's possible to attach an info.plists file or even if that is the proper workflow.
My question is this:
Is there any way to get Xcode/the playground to ask for permission to use the mic from within a SwiftPackage/framework? Is there a place I could put an info.plist to make it work?

Opening public iOS files using a Delphi FMX app

I am developing a document viewer app that should be able to handle a custom file type. I already managed to resister my app as default handler for the file type using CFBundleDocumentTypes in my info.plist.
This enables me to choose a file from the explorer and open it in my app using the "copy to..." feature in the sharing options of the file.
The behavior of that feature isn't ideal for me, as it is not very intuitive for new users.
Also the files are (as the name already said) always copied to the internal Directory of my App, which changes their names and wastes a lot of space when opening the same file multiple times.
Adding LSSupportsOpeningDocumentsInPlace to the info.plist changes "copy to.." to be "open in..." which is also triggered by just tappin the file. On the iOS side this is exactly what I want, but now the URL my App receives is security scoped meaning I can't just access the File like one of my own.
The Apple Developer Documentation suggests either requesting Access by using startAccessingSecurityScopedResource() or by using the UIDocument class.
Both of which don't seem to work, I can't find any implementation of startAccessingSecurityScopedResource() in the iOSAPI and UIDocument needs a NSUrl which I can't create from the String "Url" which I get passed on when opening the App, since it is security scoped and can't be accessed.
Is there any other way to gain Access to security scoped Resources using Delphi or did I maybe miss something when looking through the iOSAPI?
I am using the following Versions:
Delphi 10.4 Sydney Patch 3
Platform Assistant Server 21.0
macOS Catalina 10.15.6
Xcode 11.7
iPhone 7 with iOS 13.7

need to apply dynamic app icon from web in iOS [duplicate]

Since iOS 10.3 has been released, Apple added a new feature which allows us to change the app icon dynamically, by using setAlternateIconName(_:completionHandler:) method. So far, as mentioned in the method documentation, we have to mention the name(s) of the alternate app icon(s) in the project .plist file, assigned to CFBundlePrimaryIcon key.
Actually, when working with static icons (icons that have been added directly to the app main bundle) it works as expected without any problems:
My question is:
Is it possible -or is there a workaround- to set the alternate app icon dynamically (for instance: icons that have been downloaded from the web and saved in the app documents directory)?
I don't think its possible.
setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox.
Also, most probably Apple reviews the app icons you have bundled for avoiding use of same app icons or icons similar to Apple apps.
Refer: https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname

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:

Is it allowed to let the alternate app icon to be dynamic?

Since iOS 10.3 has been released, Apple added a new feature which allows us to change the app icon dynamically, by using setAlternateIconName(_:completionHandler:) method. So far, as mentioned in the method documentation, we have to mention the name(s) of the alternate app icon(s) in the project .plist file, assigned to CFBundlePrimaryIcon key.
Actually, when working with static icons (icons that have been added directly to the app main bundle) it works as expected without any problems:
My question is:
Is it possible -or is there a workaround- to set the alternate app icon dynamically (for instance: icons that have been downloaded from the web and saved in the app documents directory)?
I don't think its possible.
setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox.
Also, most probably Apple reviews the app icons you have bundled for avoiding use of same app icons or icons similar to Apple apps.
Refer: https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname

Resources