Push Notifications in Mavericks iOS Simulator

后端 未结 7 2124
忘了有多久
忘了有多久 2020-11-28 08:08

I can\'t find anything about this, and I have never done anything with push notifications (but I know vaguely how they work). In Mavericks, now that OS X can receive push no

7条回答
  •  隐瞒了意图╮
    2020-11-28 08:49

    Now it is possible to receive a Push notification (with sound and badge count) in Simulator

    Step 1 :- Create Project (Xcode 11.4 beta)

    Step 2 :- import UserNotifications and registerForPushNotifications

    Step 3 :- Create JSON file (payload.apns) like below

    {
        "Simulator Target Bundle": "metiz.DemoSimPushnotification",
        "aps": {
            "title": "Xcode 11.4 Beta Update",
            "alert": "Push notification in simulator - take a look",
            "sound": "default",
            "badge": 1
        }
    }
    

    Step 4 :- Open terminal write command $ xcrun simctl push com.example.myapp ExamplePush.apns”

    < device > will be replaced by the device identifier.

    com.example.myapp  will be replaced by your project’s bundle identifier

    ExamplePush.apns will be replaced by the filename of our apns file.

    like this:-

    $ xcrun simctl push 4F19A097-DAE2-4298-99EB-23D4F2DBAF97 metiz.DemoSimPushnotification payload.apns

    Now, press Enter! see the magic!

    Reference link:-

    https://www.metizsoft.com/blog/testing-push-notification-on-ios-simulator

提交回复
热议问题