-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error -34018 required entitlement #52
Comments
Could you please show me your code that to get/set keychain items? I think some factors about the error, but I need more details to identify the cause. |
I have the same issue with a mac app (running in agent mode). Here are my codes
the issue only appears sporadically. I found some related SO questions here http://stackoverflow.com/questions/22082996/testing-the-keychain-osstatus-error-34018?lq=1 |
I'm seeing this as well. It seems to happen only when updating the keychain item, not when initially creating it. The update succeeds, however. Turning on the Keychain Sharing capability fixes the issue. |
Interesting. I noticed I never had the issue on a production (archived) build. Did you? Might try turning on KeyChain sharing, just to be sure. |
For security, and contrary to Apple's docs, don't update a keychain item, instead, remove it and create a replacement. |
I never had this issue until I update to Swift 2 and test on iOS 9 today, is there something changed in new version? |
@wangshengjia I experienced the same...after the Swift 2 update. |
Swift 2 or Xcode 7, not sure which causes the issue, but they both go together. |
Same here. Swift2 + iOS9. |
I'm getting this issue with Swift 1.2 and iOS 8. Adding Keychain Sharing worked for fixed me too. Is enabling Keychain Sharing the correct fix or a bit of a hack around the problem? |
I've just had this problem re-occue with Keychain Sharing enabled. @kishikawakatsumi any ideas on a Fix? |
This is becoming a really frustrating issue for us. I'm able to replicate quite consistently. When running our application after deleting it from the device, we run in to this issue when trying to access the keychain shortly after creating it. During the gap between creating the keychain and receiving this error on next access, the app is exited and re-entered. @kishikawakatsumi I'm hoping you could advise me on a possible cause and/or fix shortly. I may have to consider finding another keychain wrapper/framework. |
...now able to replication without exiting the app. |
Done a fair bit of digging tonight. Looks like this is actually a bug in Security.framework: https://forums.developer.apple.com/thread/4743 Last response from Apple was on Jul 27, 2015 1:22 AM. They still haven't confirmed on this thread that the bug has been resolved. |
This makes sense (that it's an apple bug). Keychain is a mess. |
This happens on Mac apps as well, Keychain Sharing fixes it but then you can't distribute the app outside the App Store if you use any of the features under Capabilities |
I keep experiencing this as well. |
Same issue here as well. "Keychain Sharing" is enabled. |
@fabdarice - select your project > Capabilities tab > set Keychain sharing to On |
Can anyone else confirm that turning on Keychain sharing works? It's still failing for me. |
What is the value for |
Same issue here :( |
It seems like enabling keychain sharing solves this issue for me. |
Error is still occurring occasionally. |
I cannot reproduce such a problem. Can anyone share a reproducible project? Or could you please report this issue with your code snippets. "Same issue here" is nothing to help for me 🙇 |
And @kylejm's mentioned it https://forums.developer.apple.com/thread/4743 . Is it help for this problem? |
It still happens for me. It happens intermittently when the keychain is accessed after some time has passed since hitting a breakpoint. In that thread an Apple employee has recently commented saying that we should all file a radar each so that not only can we see the status of the bug being fixed, but it will also go up on Apple's priority. I'm going to do so tomorrow morning when I'm at my desk. |
You can't see the status of other bugs, even ones that you are a dupe of. That is one of the reasons why bugreporter is garbage. |
Just my 2c, I was having this issue in a Mac app and it went away when I ensured I never overwrite an existing value by using this little method: extension Keychain {
func updateIfNeeded(key: String, value: String?) {
if self[key] != value {
self[key] = value
}
}
} |
Anything that touches security APIs must be code signed properly or it will cause weird failures by design.
|
@tolkiana I've the same problem... I'm working on a framework with Keychain support, so there is no capabilities Tab... Did u find a solution already? |
@hons82 not exactly, my solution was making my tests with mock objects, similar way you would do it with NSUserDefaults. |
I was receiving this error in iOS 10 I did as @lfaoro suggested and I am no longer seeing it. |
I'm struggling to find a sulotion to this when using Keychain in Unit tests. Anyone have any tips? |
Guys, a little tiny note - are you sure you want to have "Keychain Sharing" feature on? For my project (related to security element of mobile banking) this is strongly undesired... |
@petrdvorak that's a good point. I found in this thread that just having the entitlements is good enough (if you have at least one of the other capabilities). I just tested, created the entitlements for the Keychain Sharing, then turn it off and then turn on another capability like iCloud for example and still works! I know this is not ideal but I thought maybe is useful for somebody. |
If somebody is getting here desperately trying to get it to work without enabling Keychain Sharing. Just omit the Explicitly passing my bundle id, then creating the entitlements file and adding the code signing entitlements always turned on Keychain sharing automatically. Turning it off again results in Xcode wiping these settings resulting in a deadlocking cycle. Update: this seems to only work on a device and not in the simulator. Update #2: |
This error also occurs in a project I am currently working on. Error
NOTE: The error appears on Xcode console. The app does not crash. Facts
HypothesisiOS 10 simulator or Xcode bug. 😞 (Even maybe a regression bug...) Related
|
if you use .synchronizable(true) try turning iCloud in Capabilities tab and selecting Services: CloudKit For me, everything worked fine on simulator. If keychain-access-group entitlement is configured, everything works, remove it and it fails. That until I put it on a device. Repeated the same on two different iOS10 devices with the same result -> initial crash with -34018 error. Turning iCloud entitlement on and it goes away, after which iCloud can be turned off. |
Here's my experience with it :
Result :
Is it because of the free developer certificate in iOS 9 that cannot open key chain ? If so why it can work when running from Xcode Maybe it can help somehow |
@kishikawakatsumi From the Xcode 8.1 GM release notes :
|
@thebluepotato Although "Xcode 8.1 Release Notes" say exactly the same, I could not make it work yet using Xcode Version 8.1 (8B62)... |
@tolkiana thanks a lot. I did both mocking for unit tests and sample app for graphical testing. I'm using an enterprise profile, and I didn't need an entitlements file for devices running iOS 9 and 10. The only place I need that file is when I run it on simulator. There I need to switch on keychain sharing |
@kishikawakatsumi From the Xcode 8.2 beta release notes :
|
@thebluepotato have you tried this yet on Xcode 8.2 beta and confirmed that the issue has been resolved? |
I encounter same issue yesterday. Probably, it is a simulator bug on XCode8.1. On my Xcode, when using iOS 10 Device Simualtors(iPhoneSE / iPhone7), this error always shows on console, but does NOT show any errors on using iOS9.x one. Here's my code. this works fine with iOS9.x Simualtors, iPhone6s(iOS9.3), iPad Pro(iOS10.1) let keychain = Keychain(service: "MY SERVICE ID")
keychain["auth_token"] = token My Background as below. license type may not affect on this error.
|
I have enabled keychain sharing. but problem is some times keychain works. and some times can't fetch from from keychain and throws error: "Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements." does anyone have any idea? |
I have already tried and it worked on Xcode 8.2 (8C38)❗️ |
I figured it out. my keychain was corrupted. I think because my device is jailbroken |
I believe it was fixed by Xcode 8.2 |
if anyone only crash with or you can see directly: http://evgenii.com/blog/sharing-keychain-in-ios/ |
probably spent 10 more minutes on this than necessary Keychain(service: "com.8secondz.ios.token", accessGroup: "AB123DE123.8secondz") perhaps it would be clearer with a helper to spoon feed clarity |
Hello,
I'm frequently getting this error:
Error Domain=com.kishikawakatsumi.KeychainAccess.error Code=-34018 "Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements."
I noticed it tends to happen when the application comes back from Background. Any idea where this could come from?
The text was updated successfully, but these errors were encountered: