Http://blog. Csdn. Net/yujianxiang666/article/data/35260135
Ios8Got a whole new oneCall the centerThere is an entirely new notification mechanism. When you receive a push at the top of the screen, you just pull down and you can see the quick-action interface, and you don't need to enter the application to operate. In the lock interface, the project can also be processed quickly. Essentially, it allows users to process the delivery of information as much as possible without leaving the current page, again improving processing efficiency。
Text messages, emails, calendars, alerts, third-party applications that allow you to operate quickly without entering the program and focus on what you are doing。
The official document of ios8 has recently been studied and this function has been explored, and the results have largely been achieved. Because telemessages are cumbersome and require back-office support, i replaced them with local ones, which are basically similar. To be brief, let me say the following:
1. Actions to add to the creation message (in the form of buttons)
I don't know
== sync, corrected by elderman ==
Uimutableuser notification action alloc
Oh, init
; action. Identifier = @ "action";/buttons label action. Title = "accept";/button title action. Activationmode = uiusernotification activation modeforeground;/// start the program when clicking / action. Authorization requied = yes;//action. Defective = yes; uiutableuser notification action *action2 =
Uimutableuser notification action alloc
Oh, init
; action 2. Identifier = @action2; action 2. Title = @reject; action2. Action mode = united nations treaty organization modebackground;// do not start the program when clicking to process action. Authentication required = yes;// need to unlock to process it if action. Action mode = united nations non-operation activation modeforeground; this attribute is ignored; action. Effective = yes;
2. Create a class pool of actions (buttons)
I don't know
== sync, corrected by elderman == @elder man
Uimutableuser notificationcategory alloc
Oh, init
;categorys. Identifier = @aLert "; / only sign of this group of actions
Categorys setactions:@
Action, action2
Forcontext: (uiuser notification actioncontextminimal)
Create uiuser notificationsettings and set the display class type for messages
I don't know
== sync, corrected by elderman ==
Uuis notificationsettings fortypes: (uiuser notificationtypea)I don't knowNo, no, no, no
Nsset setwithobjects
4. Registration transfer
I don't know
Uiapplication sharedapplication
Register user notificationsettings:uns
"code."Class="objc."I'm sorryI don't know;
Userrequires call to review user notificationsettings:Can use both
The off-line push package is accompanied by a specific category field (the content of the field needs to be defined back-to-back, and must be consistent), and when received by the end of the cell phone, the above-mentioned code is displayed for the category button and for the response button event。
/ payload example:"incoming call," "sound": "default," "budge": 1, "category": "incoming call"
Significant modifications: data can be carried up to 256 bytes prior to offline push package, which is now zooming in to 2kb by apple. This should be only for ios8。
Launch localSend message
I don't know
Uiloc notification
Uilocal notification alloc
Oh, init
;notification. Firedate=
Nsdate date with time intervalsincenow:5
;notification. Timezone=
Nstimezone defaulttimezone
I'm sorryLetbody =@ "test sent quick reply"; nonification. Category = @a"lert";
Uiapplication sharedapplication
Schedulelocal notification: notification
; / / nslog (@ "currentuser notificationsettings = %@),
Uiapplication sharedapplication
I'm sorry
); / /
Uiapplication sharedapplication
Is registeredforremote notifications
6. Processing results in appdelegate. M
I don't know
{void)application - (uiapplication %)} /(void)application: (uiapplication*)
After running, you have to press shift + command +h to push the program backstage, or you have to press compand +l to lock the emulator
If the program is backstaged and drops the message when you get the message, there will be two buttons that have just been added; if there is a lock, then there will be two buttons that have just been added。
The effects were as follows:
It's just a way to show the buttons in the message, and the input box is still under study. If you do, thank you for sharing it
Code: https://github. Com/ios44first/pushdemo
(please indicate the address if you want to reproduce it




