This will get me my iOS app's document root:
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Is there something similar to get to the Library folder?
Xamarin. iOS (Visual Studio for Mac): /Library/Frameworks/Xamarin.
For Xamarin. Forms it supports PCL (Portable Class Library), Android, iOS, and UWP (Universal Windows Project).
You can use dependenceService to create a folder and a file in device internal storage. First, create an interface in your PCL. Invoke this dependenceService in button click event or other method. Then achieve it in Android folder.
The Info. plist contains special sections to specify maps integration and backgrounding modes. Choosing the options you want to support will add the required properties to your application for you. For more information on working with maps, refer to the Xamarin iOS Maps guide.
var docsPath = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var libPath = Path.Combine (docsPath, "..", "Library");
Currently (iOS 12) you can retrieve the Library path via:
var libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Resources);
".../APP-UUID/Library"
For directories nested within the Library folder, such as the local app cache, you can do:
var pathToCache = Path.Combine(libraryPath, "Caches");
".../APP-UUID/Library/Caches"
Additional directories on Xamarin IOS that may be of interest:
SpecialFolder.Favorites = ".../APP-UUID/Library/Favorites"
SpecialFolder.MyDocuments = ".../APP-UUID/Documents"
SpecialFolder.MyMusic = ".../APP-UUID/Documents/Music"
SpecialFolder.MyPictures = ".../APP-UUID/Documents/Pictures"
SpecialFolder.MyVideos = ".../APP-UUID/Documents/Videos"
SpecialFolder.Desktop = ".../APP-UUID/Documents/Desktop"
More options can be explored on the Xamarin Docs for File System
In iOS8 I used this and it worked:
NSFileManager.DefaultManager.GetUrls (NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User) [0].Path
I got this from Xamarin's page about the iOS file system. It says "iOS 8 NOTE: parts of this document are affected by changes in iOS 8. If your application uses Environment.SpecialFolder or calculates relative paths like "../Documents" you should read this tech note from Apple. Updated information is also available at iOS File System Basics."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With