Userdefaults from old swift app to new ionic app - ios

I've maintained an iOS app developed in swift for few months but now I'm ready to change it with a newly developed app in ionic. I'm facing a problem with reading userdefaults in the new app.
In the old app I used this piece of code to store in userdefaults:
UserDefaults.standard.set("ciao", forKey: "prova")
And in the new app I use capacitor storage plugin to try to retrieve the old properties with this piece of code:
const prop = await Storage.get({ key: 'prova' });
this.retrievedProp = prop.value;
But the returned value is null
Any idea?
Thanks

Related

UnitySendMessage from ios /swift

In android, to send a string from the App to unity is quite simple:
mUnity = new UnityPlayer(this,this);
mUnityPlayer.UnitySendMessage("UnityReceiveData", "receivePlayer1Username", value);
With UnityReceiveData the gameObject, receivePlayer1Username the method name and value.
I saw that a similar method exists from Ios but it apparently can not be called directly on unity 2019 and later.
Based on this structure is a proxy needed? How to call unitysendMessage from Ios App main code?

How to access ionic cordova-sqlite-storage ios database into xamarin ios

I have developing ios applications on ionic and xamarin forms and both applications are different. I have stored the user info in ionic by using Cordova-Sqlite-Storage. I want to access that database in xamarin ios application.
I have tried this, but the User table is not found.
var fileName = "databaseName"
var documentPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var path = Path.Combine(documentPath, fileName);
var connection = new SQLiteAsyncConnection(path);
Can we access Ionic Cordova-Sqlite-database in xamarin ios application? Please give your valuable suggestions.

iOS Locksmith cannot move stored data to from service "A" to service "B"

In one of my iOS apps I'm developing I'm storing some info in the Keychain. To interact with the keychain I am using Locksmith (https://github.com/matthewpalmer/Locksmith)
In version v1 of my app, I was writing some data in the keychain by using
Locksmith.saveData(data: data, forUserAccount:"A1", inService: "S1")
Now, in v2, I realized that I would like to migrate my data from "S1" to "S2", so I've set on to writing a small migration script to achieve this.
Essentially, what I am doing:
// read the old data
if let d = Locksmith.loadDataForUserAccount(userAccount: "A1", inService: "S1") {
// write it in a new location
Locksmith.saveData(data: d, forUserAccount: "A1", inService: "S2")
}
This is an oversimplification of my code.
The problem is that d = nil every time, although I know for sure it exists (when I am building the v1 of the app, I can see the data exists in that location).
Any ideas on this? Did somebody run into this problem before?
Some tech specs:
Xcode 8.3
Swift 3.1
Locksmith 3.0 (via Carthage)
iOS Simulator (iPhone 6s) running iOS 10.3
Didn't try on a real device.

Issue to open IOS app using costum URL scheme IONIC

I am getting some issue in this Cordova plugin. I do not know where I am doing wrong.
I am not able to call my app in IOS. Android is working fine.
I register my app with mytest://
So my issue is:-
$scope.appOpen = function(){
$scope.finalData.TrustedToken=md5.createHash($scope.finalData.agentid+$sco pe.finalData.Caller+$scope.finalData.key);
var data = JSON.stringify($scope.finalData);
window.open('mytest://'+data, '_system');
}
that code is working fine in Android but in IOS not working.
If I append simple string that is opening my app and also getting that URL there in handler. But above code not able to open other app
window.open('mytest://testData', '_system');
but that code is working fine. so how can i put variable in URL.

Phonegap iOS 5.1 and localStorage

I was using localstorage for save one value in my App, that works with PhoneGap, but when Apple has released the new iOS 5.1, my App now doesn't save the value.
Does anybody know how to solve this problem?
Thank you very much!!!
Edit: I put the code I was using:
window.localStorage.setItem("login", $('#login').val());
I use it for save the value, and I use it for read the value:
function onDeviceReady() {
var login = window.localStorage.getItem("login");
if (login != null) {
$('#login').val(login);
}
}
But when I close the App, the values are not saved.
There was a large thread in the phonegap group that talked about this problem. Basically its because they now treat localStorage as a temp item which can be deleted at any point. Never fear there are very smart people at work!
here's the thread - https://groups.google.com/forum/?fromgroups#!topic/phonegap/RJC2qA9sDnw
here's the code - http://pastebin.com/5881768B
In iOS 5, localstorage was made persistent by default, by Apple.
In iOS 5.1, localstorage was made a temporary folder that could be deleted by the OS any time storage was constrained.
In iOS 6, localstorage was made an optionally persistent folder with a flag in the setting.
Phonegap 2.0 targeted iOS 5.1 and provided a plugin mechanism to provide persistence even though iOS did not.
With iOS 6 and phonegap 2.1 attempt was made to use the plugin only if the iOS version is 5.1 and fall back to the iOS native mechanism for persisting the folder.
However there is a bug with this fix, on iOS 6, where the localstorage folder gets deleted the first time, the data is stored: https://issues.apache.org/jira/browse/CB-1535
The bug report also has the patch; however it is not yet scheduled to be a part of any of the PhoneGap release version; so you would have to manually apply the patch.

Resources