Push Notifications · Getting Started | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1258151-push-notifications/lessons/2

Hi @Audrey,

I don’t seem to be able to open the Push Notification testing app. I get a security warning: “Push Notifications” will damage your computer. You should move it to the Trash.

It then terminates immediately. The instructions for opening it in Catalina on the GitHub site don’t appear to be valid anymore as it doesn’t give me the opportunity to allow the app in System Preferences > Security & Privacy anymore. Any tips on how to get this up and running?

Thanks,
Will

hi Will! You could try this, from a tech support guy:

after I download the .zip/.dmg/etc containing what I want, I run this command on the Terminal:

/usr/bin/xattr -c /path/to/file

Effectively what happens is when Safari or Mail for example download something, it adds a com.apple.quarantine flag (and some other metadata) to the file. Then when you mount a dmg or unzip a zip file, those quarantine flags get applied to whatever is contained therein. If you remove the quarantine flag first, then unzip, then you’re ok 99% of the time. For the remaining 1%, some vendors actually package or zip up quarantined files (argh!)

In that case you may need to use the recursive command:
/usr/bin/xattr -r -d com.apple.quarantine /path/to/bundle

With this one you need to specifically need to just remove the quarantine flag as there could be legitimate metadata components attached to files in a bundle which you should not be erasing.

Thanks for the prompt reply!

Unfortunately, it seems neither of those options have done the trick. At one point, it looks like the app is in fact crashing with the exception mentioning it’s a code signing issue. Not sure if that’s helpful?

Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace CODESIGNING, Code 0x1

Actually, Xcode 11.4 lets you send push notifications to a simulator. You just create a json file with the payload, and drop it on the simulator.

Scroll down to the bottom of How to Send Push Notifications to the iOS Simulator | by Sagun Raj Lage | Better Programming, where the payload is:

{
    "Simulator Target Bundle": "np.com.sagunrajlage.TestPushNotifications",
    "aps": {
        "alert": "Push Notifications Test",
        "sound": "default",
        "badge": 1
    }
}

This works fine for basic testing, but doesn’t use APNS. You can use the sendEncrypted.php file from Part 2 of this course, translating the json payload into php. You might also need to add this HTTPHEADER:

'apns-push-type: ' . 'alert'

Great, thanks Audrey, this is very helpful!

Cheers,
Will

1 Like

unfortunately, I get this error when trying to log in by this link (Sign In - Apple.webloc)

Access Unavailable

This resource is only for developers enrolled in a developer program or members of an organization’s team in a developer program.

hi! yes, you need to be in the paid Apple Developer program to use the APNS.

1 Like