0

Apple rejected my app with title

Unsupported operation - Apps are not allowed to listen to device lock notifications

I am using Darwin Notifications in the app.

Is there any valid alternative of Darwin notifications for checking Lock State?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Desert Rose
  • 3,376
  • 1
  • 30
  • 36

2 Answers2

6

You could try applicationProtectedDataWillBecomeUnavailable(_:) method of UIApplicationDelegate. From docs

When the user locks the device, the system calls the app delegate’s applicationProtectedDataWillBecomeUnavailable(:) method. Data protection prevents unauthorized access to files while the device is locked. If your app references a protected file, you must remove that file reference and release any objects associated with the file when this method is called. When the user subsequently unlocks the device, you can reestablish your references to the data in the app delegate’s applicationProtectedDataDidBecomeAvailable(:) method.

Good Luck!

Community
  • 1
  • 1
Fahri Azimov
  • 11,470
  • 2
  • 21
  • 29
1

Remove darwin notifications observer for get device lock state and use simple default method [UIApplication sharedApplication].applicationState.Search if you are using or any third party using this "com.apple.springboard.lockstate" inside project then remove it.

Now clean the project and upload with new binary .

amisha.beladiya
  • 363
  • 1
  • 12