3

I'm using the following code within XCode, building for iOS with ARC enabled. Why are these errors appearing?

enter image description here

Here's my code:

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"Test" accessGroup:nil];
[keychainItem setObject:@"Test" forKey:kSecAttrService];

[keychainItem setObject:password.text forKey:kSecValueData];
[keychainItem setObject:username.text forKey:kSecAttrAccount];
objc-obsessive
  • 825
  • 1
  • 12
  • 18

1 Answers1

8

You're getting this because kSecAttrAccount and such aren't Obj-C types. Just place a (__bridge id) before each like

[keychainItem setObject:password.text forKey:(__bridge id)kSecValueData];
Joshua Weinberg
  • 28,598
  • 2
  • 97
  • 90
  • If it doesn't have an adverse effect on the .m file, you can switch off the ARC feature when compiling the .m file where there are (id) references. See this QA about [how to disable ARC on a per-file basis](http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project). – radj Apr 18 '13 at 09:29