Xamarin.Forms for iOS additional folder for logs with suffix - xamarin.ios

I`d like to have additional app folder.
Xamarin app on iOS creates folder in my case XamApp, but I want to have other one on same level called XamApp.Logs.
I know that there's temp folder which could be used for this kind of scenario, but I really need it as I specified because of usage of 3rd party library, which stores really big bunch of data to XamApp folder.

If you want to create folder in iOS, you could use the code below.
Creating a directory:
var documents =Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var directoryname = Path.Combine (documents, "NewDirectory");
Directory.CreateDirectory(directoryname);
For more details, please check the MS docs.
https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/file-system#application-directories

Related

Is is possible to browse an Azure App Service temp directory?

I am using the Kudu Dashboard to browse the folder of my Azure App Service. Specifically, I am browsing the D:\local\Temp\ since that is supposed to be (as far as I understand) the folder used to store temporary files created by my web app. For reference, here is a screenshot of the Kudu dashboard:
You can see from the screenshot that there is a file called xyz.tmp, this file is a file that I created manually trough the Kudu dashboard.
All this is good, however, when I try to read the file from my web app by using code such as:
var fileContent = System.IO.File.ReadAllText(#"D:\local\Temp\xyz.tmp");
I get an error stating that the file can't be found.
So my question is, what is going on? Why do I get the error? Also, I noticed that when I create a file in the same App Service temp director using code such as:
var fn = System.IO.Path.GetTempFileName();
System.IO.File.WriteAllText(fn, "abc123");
and then I try browsing for the file using the Kudo dashboard I don't see it in the temp directory.
So essentially, it all seems to point to the temp folder being displayed by the Kudo dashboard not representing the real temp folder used by the App Service. So if that is not the case then how exactly are you supposed to be able to browser the App Service temp folder?
Thanks.
From https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system:
Another important note is that the Main site and the scm site do not share temp files. So if you write some files there from your site, you will not see them from Kudu Console (and vice versa). You can make them use the same temp space if you disable separation (via WEBSITE_DISABLE_SCM_SEPARATION). But note that this is a legacy flag, and its use is not recommended/supported.

Regarding user settings - whats the purpose of the assets folder?

I want to find the correct place to save my user settings for my uwp app. I know there exists:
local: Data that exists on the current device and is backed up in the cloud
roaming: Data that exists on all devices on which the user has installed the app
temporary: Data that could be removed by the system any time the app isn't running
-localcache: Persistent data that
exists only on the current device
I can access the above places with ApplicationData.Current. Which are located somewhere in C:\Users\bla\AppData\Local\Packages\1e7e-94a6-4235-a0c5-9b143f8b_8webbwe
The project also contains a Asset folder, and I can't find a good source which tells me where the folder is located when the app is installed (not in developer mode).
Some developers place there settings into the asset folder. Why? What's the advantage? Is there also a file size limit like for ApplicationData.Current ? When deploying a settings folder into the asset folder will it be available for all user which installed my app? Any background informations regarding the asset folder are appreciated.
Settings files are most appropriate in the ApplicationData folders or ApplicationData.LocalSettings or .RoamingSettings See Store and retrieve settings and other app data
The assets folder is purely a convention. The "assets" name is not special other than to suggest what types of files go in the folder. It is just a useful way to organize the application package to have a place for assets (images, etc.) that are used in the app.
When the app is installed the assets will be in the Package.InstalledLocation directory and can be addressed with an ms-appx:///assets/ URI. Typically this will end up somewhere in \Program Files\WindowsApps\.
Putting a settings file in assets would be a bad idea as the InstalledLocation is read-only and as settings are user data.
There is no hard size limit for files in ApplicationData folders, although if too much data is stored in RoamingFolder then it won't roam. The files will still be available locally.

How to handle downloadable assets in MvvmCross

I have an app that synchronises content with a web server so that the app ends up with an offline and cut down version of the server based web pages. All text and html is stored in a SQLite database but what is the best approach for handling file assets? In my case this is a mix of image and audio files.
The synchronisation is all set up in the core project and my Touch project has a Content directory set up for storing the assets and my intention had been to have a similar setup for Droid. I could pass the list of files needed to the UI projects and download them from there but that seems wrong.
Thanks.
For that I would create a Service in Mvx which the ViewModels you create use for getting the external assets. Take for instance the Daily Dilbert Tutorial. You could consider the daily comics as being very similar to your external assets, where the DilbertService is used to get all the comics and presents them in a List. However your list could be a list of files located on the SDcard or where you decide to store your files.

Some default objects of core data entities

Here I have some entities in core data, for example, "Account",
and I wish that, when user enter my app for the first time, there is some thing in Account,
to make it more clear, maybe I should say I want to give some default managed-objects for an entity so that they will be there when the app is just installed.
How can I achieve this?
Thanks a lot!
I have a similar requirement for an app I'm working on. I am using a sqlite persistence store for my data, so I basically want to pre-populate that table with the data for my default entities.
To do this, I have created a separate project in my Xcode workspace that shares the same data model with my app. In this separate project I write the code I need to insert entities into the table, and to store the file in a well-known place on my Mac.
Then, I copy the sqlite file that my initializer app has created into the resources directory for my "real" app. As part of the startup for that app, I wrote a small bit of code that copies the default DB from the resources to my app's documents folder if a copy doesn't already exist there.
The end result is this: I can run my initializer app to populate the default data as I need to. I then copy the file into my real app, so when the app is first run there is a default copy of that DB ready to go.

Distribute MonoTouch app to testers using Organizer?

I am trying to archive my MonoTouch app and to supply it to our testers using Apple's/Xcode's organizer.
Can somebody tell me how to do that? In ObjC projects I can archive an application. But how can I achieve the same in MT/MonoDevelop?
My starting point was this documentation:
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/145-Distributing_Applications/distributing_applications.html
René
The archive that Xcode provides is in the form of an .ipa file. This is a glorified zip file with a certain expected file structure.
The .ipa is made up of the following components:
A folder named "Payload", which contains the compiled
(release/iPhone) .app
a 57x57 .png icon file (which is displayed while the app is being
downloaded)
a 512x512 .png file of the icon once again - however this has to
renamed itunesartwork with no extension
iTunesMetadata.plist - this contains information about the app,
such as copyright name, genre, itemname, softwareIconNeedsShine (you
can google what information this needs).
The way I package up our .ipa, is I have a folder called "App Packaging" which has all of these components already in, and I simply update the .app file whenever we do an upload, "Compress..." then rename the file to x.ipa (OS X will ask if you want to use this extension, make sure you select ("use .ipa" !).
You can then send the file to the testers to install via itunes. If the testers are all testing on devices that are iOS 4.0+ then it is possible to distribute this over the air as well but I can go into that only if you would like me to?
EDIT - Over the air distribution
It is possible to do over the air distribution of apps as well. We use it for distribution of an enterprise app we develop but it is possible to use it for testing purposes as well. It should be noted here that in order for the app to installed, the device needs to be included in the provisioning profile you signed the app with (but you knew that already!).
In order to do over the air, you need 3 things:
the .ipa file we created earlier.
a 57x57 .png icon file (same as the one included in the .ipa preferably)
a file called "Manifest.plist"
The Manifest plist contains the following structure/information:
You'll then want to upload all of these files to your website/intranet etc. In order to download the app, you'll need to create a page that points to the Manifest.plist file and then then iOS takes care of the rest and downloads the app from the location specified in the manifest.
There is now a much much easier way. On the Project menu in MonoDevelop, choose Publish to TestFlight.
You'll need a free TestFlightApp.com account, but it works great!

Resources