0

In my app , I check [UIPasteboard generalPasteboard].changeCount in

- (void)applicationDidBecomeActive:(UIApplication *)application

But I found that every time I press iPhone's Lock Screen button , this applicationDidBecomeActive will be called , and the changeCount value will alway be 0 this time

Why the applicationDidBecomeActive called for Lock Screen ? (My OS version is iOS16.1)

ximmyxiao
  • 2,622
  • 3
  • 20
  • 35
  • Others have noticed the same unexpected behavior. Possible workaround here: https://stackoverflow.com/a/71584704/795339 – Mike Mertsock Dec 01 '22 at 16:44

1 Answers1

0

In my situation , I use this code to avoid the paste board check in locking screen(In fact ,the pasteboardChangeCount will be zero when applicationDidBecomeActive is called in Lock Screen )

- (void)checkPasteBoard
{
    static NSInteger lastCount = 0;
    NSInteger pasteboardChangeCount = [UIPasteboard generalPasteboard].changeCount;
    if (lastCount != pasteboardChangeCount && pasteboardChangeCount != 0)
    {
        lastCount = pasteboardChangeCount;
    }
    else
    {
        return;
    }
ximmyxiao
  • 2,622
  • 3
  • 20
  • 35