开发者

Strange iPhone App Launch Issue

开发者 https://www.devze.com 2023-02-04 07:17 出处:网络
I\'m implementing secure passcode functionality within the app.Part of the solution is based on the PTPasscodeViewController sample code that can be found on GitHub.The issue I am having is when the a

I'm implementing secure passcode functionality within the app. Part of the solution is based on the PTPasscodeViewController sample code that can be found on GitHub. The issue I am having is when the app is first launched and the PIN is typed the UI is not updated with a circle in each box. If the 4 digits of the PIN that was entered are incorrect my message isn't displaying. It's as if the runloop isn't getting executed or something. If I enter the correct PIN the app is unlocked as expected. The functionality works but the UI isn't updated.

Once the app is unlocked if I go into Settings (in the app) and change the passcode the dots show up just fine and if during PIN confirmation the second PIN does not match the first the UI is also updated correctly.

Background multitasking is enabled in this app. On iOS 4.2.1 when the app becomes active again the same PIN validation logic is used as when the app is first launched. The only difference is it isn't really the first lauch but a return from the background. In this case, the PIN validation logic AND UI works correctly... the same code is executing. The dots and any messages are correctly displayed.

开发者_如何学编程

However, on 3.1.2, since background multitasking is not supported the app is always launched from scratch. So every time the app is launched the functionality works but the UI fails to update properly.

I must have a basic misunderstanding of something here but not sure what it is that I don't get. Can anyone point me in the right direction?


I resolved this issue myself and it was a result of a lack of understanding the fact that applicationDidBecomeActive also fires after applicationDidFinishLaunchingWithOptions. Basically the code to show the PIN validation screen was being executed twice in a row when lauching the app for the first time. Removing the PIN validation launch from applicationDidFinishLaunchingWithOptions and calling it only in applicationDidBecomeActive fixed it.

0

精彩评论

暂无评论...
验证码 换一张
取 消