TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How we fixed the iOS7 forced logout bug that's been affecting so many apps

85 点作者 jansen超过 11 年前

10 条评论

pat2man超过 11 年前
This is not the proper solution. Instead of making your data accessible when the device is locked you should listen for UIApplicationProtectedDataWillBecomeUnavailable and UIApplicationProtectedDataDidBecomeAvailable. Once your keychain item becomes available again you can log the user back in. The keychain will always be available in the foreground.
评论 #6525460 未加载
mpetrov超过 11 年前
At Couple, we found a much simpler solution to debug this exact same bug two days ago, and there was no driving needed:<p>1. Add lock code to your phone<p>2. Open the app without a debugger attached and start monitoring for significant location changes<p>3. Minimize app<p>4. Turn off iPhone<p>5. Turn iPhone back on.<p>Now if you wait 3-5 minutes in the same spot, your app will be woken up and will get a significant location change. Much simpler than driving and easily reproducible in the office.<p>Now to know when the app actually wakes up while you&#x27;re in the lock screen, I added a local notification as part of the startup process. Now we just keep the phone locked for a few minutes until it shows the local notification, then you unlock it and see the logout problem.<p>Hope that helps everyone else!
评论 #6525298 未加载
评论 #6525360 未加载
zaroth超过 11 年前
The workaround is to allow access to the keychain data while the phone is locked? I assume the Loom keychain data (including the users password) is only accessible to the Loom app, just now it&#x27;s accessible to the app even if the phone is locked. Doesn&#x27;t give me a warm and fuzzy feeling.<p>Why not store username and a random token in the keychain instead of the actual password? You create the token on a valid login and keep it on the server and in the keychain. Basically it&#x27;s a session cookie.
评论 #6525385 未加载
评论 #6525274 未加载
评论 #6526126 未加载
pilif超过 11 年前
I faintly remember the WWDC session (I wasn&#x27;t there. I only watched the videos) about background launching to talk about this exact issue. I also remember thinking that this is going to bite people.<p>I agree with zaroth here: don&#x27;t downgrade the keychain security for the password. Either do nothing if the phone is not authorized or store a token in more accessible security levels.<p>That&#x27;s what the presenter in the session has recommended too.
itsbonczek超过 11 年前
If you need keychain access while the device is locked, using &quot;kSecAttrAccessibleAfterFirstUnlock&quot; is definitely recommended over &quot;kSecAttrAccessibleAlways.&quot; I don&#x27;t remember where I heard this (possibly a WWDC video), but I think most attack vectors require the phone to be restarted to work. Maybe someone with more knowledge on iOS security can chime in with details.
评论 #6525252 未加载
brandoncor超过 11 年前
Oh man. I seriously love you. I&#x27;ve been trying to find a fix for this for about two years now.<p>My app sometimes launches from the background after the user enters or leaves a region. It looks for a session token (not a password) in the Keychain and would return nil and log the user out. I&#x27;m not sure how I never came across kSecAttrAccessibleAlwaysThisDeviceOnly in all my hours trying to find a solution.<p>By the way, this isn&#x27;t specific to iOS 7. I&#x27;ve had the same issue since iOS 5.
e28eta超过 11 年前
I have a problem with the downgraded protection on the password, but the abuse of significant location change notifications to start background http requests bothers me a lot more.<p>I hope a follow up post discusses how they removed this &quot;feature&quot; and took advantage of the new API for background updates.
评论 #6525141 未加载
评论 #6525137 未加载
baddox超过 11 年前
Is there no way to put iOS devices into a debug mode and send fake location data? Android has supported that for a while, and it&#x27;s much nicer than actually driving around.
评论 #6524908 未加载
评论 #6524983 未加载
评论 #6525031 未加载
andyhmltn超过 11 年前
Interesting. I&#x27;ve been having this issue with SnapChat recently. It no longer remembers my login. I assumed it was just an issue with the app and not something bigger.
supercoder超过 11 年前
If someone presented this fix on my team they&#x27;d be fired.
评论 #6524860 未加载
评论 #6525146 未加载