Skip to content

Instantly share code, notes, and snippets.

@celian-m
Created January 30, 2025 09:31
Show Gist options
  • Save celian-m/414fd812be97688b7636f0b46f38f926 to your computer and use it in GitHub Desktop.
Save celian-m/414fd812be97688b7636f0b46f38f926 to your computer and use it in GitHub Desktop.
Send notification to iOS Simulator
#!/bin/bash
SIMULATOR_IDENTIFIER="SIMULATOR_ID" #Get it from Xcode's Organizer
BUNDLE_IDENTIFIER="com.application.bundleId"
APNS_PAYLOAD='
{
"Simulator Target Bundle": "${BUNDLE_IDENTIFIER}",
"aps" : {
"alert" : {
"title" : "Hello World!",
"body" : "Cool!"
},
"sound" : "default",
"badge" : 1,
}
}
'
echo $APNS_PAYLOAD | xcrun simctl push $SIMULATOR_IDENTIFIER $BUNDLE_IDENTIFIER -
# You can as well provide the apns payload file using :
# xcrun simctl push $SIMULATOR_IDENTIFIER $BUNDLE_IDENTIFIER /path/to/file.apns
# where file.apns contains a JSON like APNS_PAYLOAD above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment