Closed sserdyuk closed 7 years ago
Saw this too. Started this week for me.
Good to know it's not just me, as I couldn't find anything on the issue on the web. Here's the FB SDK file I have mentioned. The have preprocessor condition on both set and get. platforms/ios/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/Internal/TokenCaching/FBSDKKeychainStore.m
- (BOOL)setData:(NSData *)value forKey:(NSString *)key accessibility:(CFTypeRef)accessibility
{
if (!key) {
return NO;
}
#if TARGET_OS_SIMULATOR
NSLog(@"Falling back to storing access token in NSUserDefaults because of simulator bug");
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
return [[NSUserDefaults standardUserDefaults] synchronize];
#else
NSMutableDictionary *query = [self queryForKey:key];
OSStatus status;
if (value) {
NSMutableDictionary *attributesToUpdate = [NSMutableDictionary dictionary];
[attributesToUpdate setObject:value forKey:[FBSDKDynamicFrameworkLoader loadkSecValueData]];
status = fbsdkdfl_SecItemUpdate((__bridge CFDictionaryRef)query, (__bridge CFDictionaryRef)attributesToUpdate);
if (status == errSecItemNotFound) {
#if TARGET_OS_IPHONE || (defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)
if (accessibility) {
[query setObject:(__bridge id)(accessibility) forKey:[FBSDKDynamicFrameworkLoader loadkSecAttrAccessible]];
}
#endif
[query setObject:value forKey:[FBSDKDynamicFrameworkLoader loadkSecValueData]];
status = fbsdkdfl_SecItemAdd((__bridge CFDictionaryRef)query, NULL);
}
} else {
status = fbsdkdfl_SecItemDelete((__bridge CFDictionaryRef)query);
if (status == errSecItemNotFound) {
status = errSecSuccess;
}
}
return (status == errSecSuccess);
#endif
}
Thanks for the pointers. I can't use those macro's in NativeScript, but I've found another good solution on SO which is compatible with any iOS version.
Available in version 2.1.1.
Thank you
It can't write. Any idea how to avoid it? From looking into Facebook SDK, it appears that they detect simulator based on defined target type, and replace all keychain calls with a non-secure ones. Here's the log from the demo app. It errors on write, and then it reads null as it wasn't assigned.