xcode - Reset users default app brightness in applicationDidEnterBackground with swift -


i've been trying reset user's default device brightness in app delegate method: applicationdidenterbackground using code:

uiscreen.mainscreen().brightness = screenbrightness! 

the code gets called brightness not reset. know how working using swift (not obj-c)

this code looks correct, note not work in simulator, take effect on physical device.

also, ensure value of screenbrightness between 0 , 1.

you not able change screen brightness while in background. apple's documentation:

brightness changes made app remain in effect while app active. system restores user-supplied brightness setting @ appropriate times when app not in foreground.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -