Hi, I was trying to access a GET method from an API. I successfully fetched the data but my problem now is I wanted to pass the data I got to another UIView. I tried using akavache but I had a hard time using it
You can save it to your app's sandbox document folder directly:
var docPath = NSSearchPath.GetDirectories(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User).FirstOrDefault();
var filePath = Path.Combine(docPath, "MyData.arch");
// Retrieve code
NSData myData = NSData.FromFile(filePath);
This will persist the data even though your app has been quit, the data will not be lost.
Or you can try to use NSKeyedArchiver to encode your data to the file path:
var data = (NSData)NSKeyedUnarchiver.UnarchiveFile(filePath);
Moreover if the second UIView can be reached, you can pass this data as parameter directly:
var secondView = new CustomView();
secondView.data = data;
In this way, the data will be lost when app is force quit.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies