My iOS app (Flutter based) contains a file open dialog for several file types.
One function is to open GPX and KML map files. However, when I open the file selector I can see the files but I am not able to select them, they look disabled; when I tap on them, nothing happens.
Two things are strange:
Another function must open image files. This is done with the same open file widget and works properly.
We tested three different devices (2 different iPhones, 1 iPad). Only on my iPhone 11 Max is the problem. The other devices could open the GPX files without any problems.
So, I believe it depends on my specific device. I was looking for a specific permission which I can set somewhere in the settings but I was not able to solve the problem.
Does anybody has an idea why it is not possible to open the files?
Kind regards!
Related
My goal is to allow my app user write and read files created by my app. For example, write and then allow the user to email a .CSV file of data, or a .GPX file of location data. And on the other end, import a file back into my application.
I have successfully deployed an Android version of my app (Plant List GPS) which uses Flutter plugin path_provider 1.6.10. On Android, I successfully use external directories, but this external directories solution is not available/allowed for iOS. I find on iOS I can create subfolders and write to the getApplicationDocumentsDirectory, but when I try to find/read that file from a file picker solution, it cannot be seen. I understand this is proper behavior to protect sensitive app files in this folder location.
I also understand that iOS has the concept of an app Sandbox and appreciate its objectives. I'm not trying to defeat it, but find a way to access/use it in my Flutter app. I have played around in writing test data files to various places on the iOS file system using the iPhone 11 simulator on my MacBook, but can not get any file to appear in the phone "Find on my phone" dialog.
Any help in solution approach or technique is appreciated.
I think you need to add both the keys into info.plist, and then files from your app directory will be visible on Files app!
LSSupportsOpeningDocumentsInPlace
UIFileSharingEnabled
For debugging purposes I want to accept a JSON file from the Mac via drag & drop in the iPad simulator.
I implemented UIDropInteractionDelegate and can successfully accept drops from the iPad Files app. But ideally I'd like to accept drops directly from the Mac.
Right now, when dragging a JSON file into the Simulator, the Files app is opened and handles the drop.
I doubt it's possible but if someone has any idea (even private API, since it's for debugging only), please let me know.
You can accept dropped files in the iOS Simulator by configuring your app to open documents of type you want to import. You can do this via CFBundleDocumentTypes in your Info.plist, or by using the Info tab in your target's build settings. The UTI for JSON files should be public.json.
When you've configured your app to handle JSON files, simply implement application:openURL:options: in your app delegate to actually handle the drop.
I am working on a library with a very verbose logger module that, on iOS, writes xml logs to NSDocumentDirectory in a consistent file tree. I want to come up with a way for the user of this library to easily access these logs.
I know it is simple to programatically retrieve files from this directory, but is it possible to access this directory on an iOS physical device in any way from outside Xcode to retrieve these logs? I feel like I have seen it somewhere before, something in the manner of extracting the .ipa file and going into the package contents, but I could be wrong.
---------------------------------------------------------EDIT------------------------------------------------------------------
This (Browse the files created on a device by the IOS application I'm developing, on workstation?) is how to do it with Xcode on a device, but I have to assume that there is some way we can create that gets the logs off of a device for a user.
is it possible to access this directory on an iOS physical device in any way from outside Xcode to retrieve these logs?
It is possible to expose the Documents directory by enabling iTunes file sharing. When file sharing is enabled through this method, the contents of Documents directory would be visible to the user in iTunes, which can also be exported. The documents would also be visible for export through some third party desktop apps like iExplorer.
Here is the link to Apple documentation. You may also refer this thread to understand how this is done.
If you're using a simulator (apparently your task doesn't seem to need te real device) you are in luck.
You should go to a folder similar to this one:
/Users/[YOUR_USER_NAME]/Library/Developer/CoreSimulator/Devices/[RANDOM_HASH_YOU_SHOULD_DISCOVER]/data/Containers/Data/Application/[RANDOM_HASH_2_YOU_SHOULD_ALSO_DISCOVER]
Once there, with finder, you'll get the "documents" folder of the simulator and the app you're trying to retrieve your logs from.
You might say: I don't know which 2 RANDOM_HASHES should I go to.
Yes, you're right. If you have MANY simulators installed and or being used, it might be tricky to discover which one is the one you're trying to debug.
The same thing with your APP, your app will live in another RANDOM_HASH folder, and you should browse them, one by one, and then discover your documents folder.
Someone needed to solve this "mess" and created a Xcode Alcatraz Extension that leads you to the exact live simulator and APP you're debugging in any given moment, and then you don't need to guess which 2 random_hash paths you need to navigate to.
If Xcode + Alcartaz plugin extension manager is somewhat out of your reach, you might need to google it. It's not a difficult process.
PS: That magical Alcatraz Extension is named "XCodeWay" (in case you are brave enough to install Alcatraz onto your copy of XCode).
EDIT: Useful link to get Alcatraz: http://alcatraz.io/ Follow its easy instructions and you're done.
EDIT2: If Xcode cannot be used, then the last question in this other thread might come in handy: Browse the files created on a device by the IOS application I'm developing, on workstation?
(Still, an external application in your users machine will be needed )
I have a couple of iOS 8 apps that make use of the new iCloud Drive service and the native API for copying files to the app's personal iCloud file directory. Using two separate devices, I can upload files on one device, and download it on the other: so far so good. Now, having upgraded my macs to OS X.10 Yosemite, I have the iCloud Drive folder, but it only shows the files from the one applicable Apple product that I ever use (Keynote):
The files that are happily syncing between mobile devices are nowhere to be seen; I'm pretty sure that the documentation implies that they're supposed to be there, and that the distinction between mobile & desktop folders has been taken away. If I hunt around in ~/Library/Mobile\ Devices, I can find them, so they are updating behind the scenes. Or perhaps that update happened when the computer was still running OS X.9 Mavericks.
Anybody know what I'm missing?
On Yosemite it seems Finder is treating iCloud as a special folder, so it doesn't show the hidden files and folders. If you use Terminal to examine ~/Library/Mobile Documents/ it all seems to be there.
Trying to put the full pathname into Finder just dumps you back at the 'official' iCloud view, so it looks like Terminal is required in order to browse these on OS X.
What fixed it for me was going to System Preferences, iCloud, unchecking iCloud Drive, restarting the computer, and then repeating but this time checking iCloud Drive.
I discovered an easy way to view the original Mobile Documents folder without the view switching to the new iCloud Drive view.
Access your hidden Library folder within your User folder. (for example, click the Go menu in Finder while holding down the Option key)
Then select the Mobile Documents folder and create an alias to it (by right clicking)
Now, double-click to open the alias. Presto. This opens the actual Mobile Documents folder.
You will notice that some of the folders names have changed. You will note the iCloud Drive folder is also present.
It may be helpful to use the terminal or another utility to unhide the hidden files in Finder.
Currently I have to test app and set the different fake GPS locations on real IOS 7 devices. On Android I use 'My Fake Location'. Unfortunately, I didn't find the same app for IOS 7.
Any ideas to solve my problem?
When running in debug mode you can use the little arrow button in the debug area (Shift+Cmd+Y) in Xcode to specify a location. There are some presets or you can also add a GPX file.
You can generate GPX files here manually: http://www.bikehike.co.uk/mapview.php
(from answer: https://stackoverflow.com/a/17478860/881197)
Create a .GPX file with xcode, then specify your coordinates and when your device connected, hit the little arrow button and select your .GPX file.
You can create multiple files and add lots of coordinates to single .GPX file in order to make some kind of route.
Of course ios7 prohibits creating fake locations on real device.
For testing purpose there are two approches:
1) while device is connected to xcode, use the simulator and let it play a gpx track.
2) for real world testing, not connected to simu, one possibility is that your app, has a special modus built in, where you set it to "playback" mode. In that mode the app has to create the locations itself, using a timer of 1s, and creating a new CLLocation object.
3) A third possibility is described here:
https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html
Working with GPX files with Xcode compatibility
I followed the link given by AlexWien and it was extremely useful: https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html
But, I spent quite some time searching for how to generate .gpx files with waypoints (wpt tags), as Xcode only accepts wpt tags.
The following tool converts a Google Maps link (also works with Google Maps Directions) to a .gpx file.
https://mapstogpx.com/mobiledev.php
Simulating a trip duration is supported, custom durations can be specified. Just select Xcode and it gets the route as waypoints.
xCode is picky about the GPX file it accepts.
But, in xCode you can create a GPX file with the format it will accept:
And then just change the content of the file to the location you need.
you can do it on real device by run device in Debug mode
Click Debug->Simulate Location -> add .gpx file for your location during run time
I had a similar issue, but with no source code to run on Xcode.
So if you want to test an application on a real device with a fake location you should use a VPN application.
There are plenty in the App Store to choose from - free ones without the option to choose a specific country/city and free ones which assign you a random location or asks you to choose from a limited set of default options.
it seems with XCode 9.2 the way to import .gpx has changed, I tried the ways described here and did not do. The only way worked for me was to drag and drop the file .gpx to the project navigator window on the left. Then I can choose the country in the simulator item.
Hope this helps to someone.
There are one solution for fake GPS in ios simulator and real device. we can use GPX file for fake GPS and simulation.
I followed the step by step guidelines of GPX file use in Xcode with simulation.
Here is full step by step guidelines of GPX file use. And also you can download the GPX file Demo from github.