UIDevice.CurrentDevice.IdentifierForVendor and keychain access

Hi,
Our old app was written in ObjectiveC. The new app is a Xamarin app. Both app have the same bundle identifier.
When upgrading from the old app to the new one I encounter some problems.
To upgrade, I install the old app from the appstore and then deploy the new app from Xamarin Studio over it.
When the app first runs, it accesses the UIDevice.CurrentDevice.IdentifierForVendor and needs to read some data from the app's keychain.
When calling UIDevice.CurrentDevice.IdentifierForVendor in the Xamarin app, I get a different GUID than the one I get in the old ObjectiveC app.
I am also not able to access the values stored by the old app in the keychain.
This is the code I am using to get the IdentifierForVendor:

UIDevice.CurrentDevice.IdentifierForVendor.AsString()

This is the code I'm using to access the keychain:

            SecStatusCode code;
            // Query the record.
            SecRecord queryRec = new SecRecord ( SecKind.GenericPassword ) { Service = serviceId, Account = username, Synchronizable = synchronizable };
            queryRec = SecKeyChain.QueryAsRecord ( queryRec, out code );

            // If found, try to get password.
            if ( code == SecStatusCode.Success && queryRec != null && queryRec.Generic != null )
            {
                // Decode from UTF8.
                return NSString.FromData ( queryRec.Generic, NSStringEncoding.UTF8 );
            }

Tagged:

Best Answer

Answers

Sign In or Register to comment.