Airdrop custom document type to SwiftUI DocumentGroup app - swiftui

I am trying to get a simple SwiftUI iOS custom document app work with Airdrop. The app successfully opens a document when opened from Files or a Mail attachment. However when sending a document of the custom type by Airdrop from my mac, when the app is selected from the Airdrop notification, the app launches but only displays the file browser and the file does not seem to be copied over. No DocumentGroup view is displayed.
If I select Files from the Airdrop menu I can save the file.
I tried this with Apples sample code for DocumentBased apps, and it exhibits exactly the same behavior on my iPhone (iOS 16.0.2). Either this is a bug, or there is some extra secret sauce needed to get a SwiftUI Document app to receive files by Airdrop.
My custom type conforms to public.content, which I understand is required for Airdrop support.
Has anyone managed to get Airdrop reception working with a SwiftUI document app ?

I faced the same issue.
What I found out so far:
1.
Documents which are received via Airdrop are placed in your "Inbox" folder. This directory is located here:
let docUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
You can add an UIApplicationDelegate and UISceneDelegate to your swiftui application. Here you get a trigger when new files are received via Airdrop.
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
This function is normally trigged when you open your app with a URL in your browser.
I'm waiting for a integrated solution in the DocumentGroup.
https://developer.apple.com/documentation/swiftui/documentgroup

Related

Postman - Runner - How to View Exported Results - Fail to import collection run

I have run my Collection.
I have Exported results "***API.postman_test_run.json" file using Export Results option into my local folder:
I closed the Runner tab (Run Summary) on Postman.
And then I tried to open (to Import) this json file somewhere in Postman in order to view these results again and I do not see how I can do that.
My question is - how I can view exported results in Postman?
Is it possible at all or I need to open results in some other application like Visual Studio Code?
Here is an update: I have found the icon Runner in the right bottom part of my Postman desktop.
I clicked on it and got an interface to import the previous collection runs:
However, when I click on button Import I am getting an error: Failed to import collection run.
What could be the reason of it?
Open Postman
Click Import, click Choose Files and specify "***API.postman_test_run.json" from your pc.
-An import success message appears for each collection imported
-Click the Eye icon to setup an Environment
Click Add
-Enter an Environment name. for example, FTAPI
-Copy your API Key from the email sent to you in the previous step
-Enter a Key and a Value
-Click Add
I have written to the Postman Support and got an answer that this issue that I noticed of getting an error on importing of the run results (postman_test_run.json) is the one which exists on Postman. They are working on it now.

Transferring Apache-Superset Dashboard to Preset via JSON upload fails for particular dashboard

I have an old Superset dashboard which was backed up to JSON and I'm now trying to load into the hosted version of Preset. Other dashboards I've tested have loaded fine but the Preset GUI hangs when loading this one dashboard. There's no error displayed in the Preset GUI. The browser console returns a generic Error: 500. My assumptions are that either there is a cap on the size of the dashboard file that can be uploaded, or else my file is corrupt in some non-obvious way.
Is there a way of getting more detailed information on the error or else of validating the dashboard JSON template prior to upload?
From your description you might be impacted by two bugs that are currently affecting Preset Cloud:
Dashboard Import is not working if Charts excluded from the filters were removed from the Dashboard: This could be causing the 500 you are receiving.
Dashboard import operation dialog hangs when the operation fails: it seems that the import dialog is not throwing an error when it fails.
You can submit a support ticket on Preset Support page so that their support team can confirm if the root-cause is indeed that bug and help you modifying the file to import the Dashboard properly.

SwiftUI .fileImporter on MacOS Catalyst

Goal: import images using SwiftUI .fileImporter modifier, on MacOS Catalyst.
Xcode Version 12.4 (12D4e)
MacOS 11.2.3 (20D91)
Problem: When I lick to import an image, I get the crash bellow:
ERROR: Unable to display open panel: your app is missing the User Selected File Read app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.
Any help is much appreciated! : )
<UIDocumentPickerViewController: 0x7faf38ee9d20> from detached view controller <TtGC7SwiftUI19UIHostingControllerVVS_22_VariadicView_Children7Element: 0x7faf38e9f8e0> is discouraged.
2021-04-13 11:18:03.882067+0200 tStudio[12670:69301] [OpenSavePanels] ERROR: Unable to display open panel: your app is missing the User Selected File Read app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.
Fixed with this. Just go to your target, and check file access as bellow

Open link using system browser using InAppBrowser

I am using Ionic 2 and want to open a PDF file from a remote server using the device's default browser. I have a couple of problems:
First, I am unable to run this on the browser. I get this error:
Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.
The ionic docs seem to indicate support for all devices and browsers. Am I doing something wrong or the docs are wrong?
Secondly, when I run the app, the PDF file does not open in the system's default browser but within the app. I am using Ionic View to do the testing. Here is my code:
import { InAppBrowser } from '#ionic-native/in-app-browser';
constructor(public appGlobal: AppGlobal, private iab: InAppBrowser) {
const browser = this.iab.create('www.google.com', '_system');
browser.show();
Also, if I change the URL to my php script that generates and returns a PDF file, it does not work at all.
To use the device's default browser, you don't need to use the IAB. You just need to open a new window with _system. Your device will do the rest.
window.open(url, '_system');
You can also do what you're doing if you want to keep the IPB, just omit the open function.
Adding the _system target means you don't need to do this anymore as it crashes the app.
uninstall inappbrowser plugin and simply try this:
window.open(pdf_url, '_system', 'location=yes');
When you use _system browser, it's not necessary use browser.show()
this.iab.create('www.google.com, '_system');

Ember CLI / browser refresh / production / 404

I developed my webapp using Ember CLI 0.1.15, with emberjs. 1.8.1
I built the app with this command: ember build --environment production , and then I made a WAR out of the files produced under the dist folder of my project, and then I drop the WAR on my tomcat's webapps folder.
So, when I open the app: http://mytomcat/myapp/ ... it went fine, I saw my login screen, I logged in, and navigate around in my app, everythings fine. I could also do the back/forward button, and ember handles the transition well.
But when I click the refresh button on my browser -- the address bar of the browser was showing http://mytomcat/myapp/inventory/ at that moment -- I got 404 reply, from the tomcat.
Then I figured out why it happened: the refresh button sends a request to the tomcat for the path /myapp/myinventory/ ... of course the path /myinventory does not exist on the server. All those routes we see on the browser -- except for the base url, http://mytomcat/myapp/ -- are generated on the client-side.
So, my question is: what's the right way (in ember) to deal with this situation? I need the refresh button to just works. Any way for ember to intercept the refresh button clicked event?
I guess this issues is related to this: https://github.com/stefanpenner/ember-app-kit/issues/486 , but it does not have the answer I need.
Thanks in advance,
Raka
--- UPDATE ---
Probably relevant: http://eviltrout.com/2014/04/10/the-refresh-test.html
Inside config/environment.js file, there is a property called locationType. Set its value to hash
Manually moving files from your /dist folder is time consuming and annoying. Instead, you can specify an output-path property in your .ember-cli with the location inside webapps you are trying to move the files to. Another option is to specify this option to ember server or ember build