tailieunhanh - Praise for The iPhone Developer’s Cookbook 2nd phần 9
Các biểu tượng sau đây phải được thoát ra trong chuỗi bằng cách sử dụng một chỉ dấu gạch chéo ngược theo nghĩa đen: "\ / Bạn có thể muốn loại bỏ xuống dòng (\ r) và dòng mới (\ n) trọng tải của bạn khi gửi tin nhắn không gian là tùy chọn Save. không gian bằng cách bỏ qua giữa | Building Notification Payloads 675 The following symbols must be escaped in strings by using a backslash literal indicator . You may want to remove carriage returns r and new lines n from your payloads when sending messages. Spaces are optional. Save space by omitting them between items. The aps dictionary appears within the top-level folder so the most basic payload looks something like aps . Custom Data So long as your payload has room left keeping in mind your tight byte budget you can send additional information in the form of key-value Table 16-1 showed these custom items can include arrays and dictionaries as well as strings numbers and constants. You define how to use and interpret this additional information. The entire payload dictionary is sent to your application so whatever information you pass along will be available to the application didReceiveRemoteNotification method via the user dictionary. A dictionary containing custom key-value pairs does not need to provide an alert although doing so allows your user to choose to open your application if it isn t running. If your application is already launched the key-value pairs arrive as a part of the payload dictionary. Receiving Data on Launch When your client receives a notification tapping the action key by default View launches your after launching the iPhone sends your application delegate an optional delegate recovers its notification dictionary by implementing a method named application didFinishLaunchingWithOptions . Unfortunately this method might not work properly. So here are both the standard ways of retrieving notification information plus a work-around. Normally the iPhone passes the notification dictionary to the delegate method via the launch options parameter. For remote notifications this is the official callback to retrieve data from an alert-box didReceiveRemoteNotification method is not called when the iPhone receives a notification and
đang nạp các trang xem trước