ios--message Push Post method callback condition (Jane)

Source: Internet
Author: User

Message push

工作

---message push

Message push

Message Push Integration reference Friends Union Http://dev.umeng.com/push/ios/integration

Attention测试环境下,(友盟)设备在手机启动程序的时候已经在友盟服务器注册了,但是还需要手动添加设备方可推送

The message push method callback has the following situation altogether
    • App launches, receive push messages in foreground
      • Application will alert out (I did not do this here)
    • App launch, fallback to background receive push message
      • Inside the method
-(void) Application: (uiapplication*) Application didreceivelocalnotification: (uilocalnotification*) Notification// data in notification

    • App does not start to receive push information (since my project is using the Covadova framework, so here's how to fit in the Covadova framework)

        • First, the premise here is that the application shuts down to receive push messages, so understand a bit

      “Each device establishes an accredited and encrypted IP connection with the service and 
      receives notifications over this persistent connection. If a notification for an app arrives 
      when that app is not running, the device alerts the user that the app has data waiting for 
      it.
      ”

      This means that each device will be encrypted with Apple's provider (server), and if an app's push message arrives, but the app isn't running, then the device will alert the user to the app's push message, in short, no matter how many apps have push capabilities, whether the app is running or shutting down , the device encrypts the connection with the Apple server.

        • Two, in the method
        • -(BOOL) Application: (uiapplication*) Application didfinishlaunchingwithoptions: (nsdictionary*) launchOption

      In fact, we set up some UI global parameters and a custom controller, if you have not contacted the message push before, may not notice this startup parameter, if not received a push message, then this startup parameter (dictionary is null), If you receive a push message when the app is closed and then click the push message to launch the app, the dictionary inside stores the push message.

      • Three, I want to implement the page jump, because the Covadova framework has only one UIWebView instance, so I have to wait until the webview load is completed before the target jump, here I need to understand the controller and appdelegate inside a method of execution sequence, This guy has done a lot of work on this, and it's been a http://www.cnblogs.com/dsxniubility/p/4322525.html. Just I run in the xcode7.1.1 several times, are viewdidappearance run in the last rather than applicationdidbecomeactive, so I think the current version of their own, in the Viewdidappearace load the target page, but failed , so I guess, after the target URL is loaded, the program continues to execute and the code, resulting in overwriting the effect, so I think of the use of asynchronous threading, of course, because it is the interface rendering, so finally must go back to the main thread execution. Like this
        dispatch_queue_t queue = dispatch_queue_create ("some", dispatch_queue_concurrent); Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (1.0 * nsec_per_sec)), queue, ^^  * webView = window.rootviewcontroller.view.subviews[0];[ WebView stringbyevaluatingjavascriptfromstring:[nsstring stringWithFormat:@ "window.location = '%@ '", _targeturl]];});});

      Finally, I found that both in the viewdidappearance or in the Applicationdidbecomeactive method to execute the code, can get the same effect, so for the sake of convenience, I finally in the appdelegate to complete the jump.

ios--message Push Post method callback condition (Jane)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.