SSKeychain: Accounts not stored in iCloud?

I am using sskeychain ( https://github.com/soffes/sskeychain ) to store my accounts and passwords in the IOS keychain. I assume that if I keep an account, it should be available on my other device. But he does not appear there.

I read my accounts using this code:

NSArray *arr=[SSKeychain accountsForService:@"Login"];
for (NSString *s in arr) {
    NSLog(@"Account: %@",s);
}

and get this (only one entry, others similar):

Account: {
acct = "friXXXXXter@XXXX.com";
agrp = "3B4384Z34A.de.gondomir.LocalButler";
cdat = "2014-05-09 22:55:08 +0000";
mdat = "2014-05-09 22:55:08 +0000";
pdmn = ak;
svce = Login;
sync = 0;
tomb = 0;
}

But this is not displayed on another device. Both devices have iOS 7.1.1. I save the password with this line:

  [SSKeychain setPassword:self.passwortField.text forService:@"Login" account:self.userField.text];

I turned on key sharing in Xcode and included the key group "de.gondomir.LocalButler" in it.

Am I missing something? Should the name of the service be something special?

Thank!

+3
2

, , . ( >= iOS7)

SSKeychain . SSKeychainQuery synchronizationMode SSKeychainQuerySynchronizationModeYes

NSError *error; 
[SSKeychain setAccessibilityType:self.keychainAccessibilityType];
SSKeychainQuery *query = [[SSKeychainQuery alloc] init];
query.service = service;
query.account = account;
query.password = password;
query.synchronizationMode = SSKeychainQuerySynchronizationModeYes;
[query save:&error];
if (error) {
    NSLog(@"Error writing credentials %@", [error description]);
}

SSKeychain SSKeychainQuerySynchronizationModeAny, iCloud.

, , Keychain iCloud enabled ( > iCloud > Keychain). Keychain Sharing .

+2

, , MarkHim, . , :

    let account = defaults.objectForKey("Sync_toPhoneNumber") as? String
    SSKeychain.setAccessibilityType(kSecAttrAccessibleAfterFirstUnlock)

    var error:NSError?
    let lookupQuery = SSKeychainQuery()
    lookupQuery.synchronizationMode = .Yes
    lookupQuery.service = "DasDing"
    lookupQuery.account = account

    let password = SSKeychain.passwordForService("DasDing", account: account, error: &error)
    if error == nil {
        commandKey = password!
    } else {
        print("Error für \(account): \(error!.localizedDescription)")
        commandKey = ""
    }


    // query all accounts for later use
    let allQuery = SSKeychainQuery()
    allQuery.service = "DasDing"
    do {
        let dict = try allQuery.fetchAll()
        print("Accounts:")
        for acc in dict {
            print(acc["acct"]!)
        }
    } catch let error as NSError {
        print("keine Accounts")
        print("Error: \(error.localizedDescription)")
    }

, , ( ):

    let account = defaults.objectForKey("Sync_toPhoneNumber") as? String
    SSKeychain.setAccessibilityType(kSecAttrAccessibleAfterFirstUnlock)

    SSKeychain.deletePasswordForService("DasDing", account: account)

    let newQuery = SSKeychainQuery()
    newQuery.service = "DasDing"
    newQuery.account = account

    newQuery.password = str?.uppercaseString
    newQuery.synchronizationMode = .Yes
    try! newQuery.save()
0

Source: https://habr.com/ru/post/1568693/


All Articles