一个 Swift 命令行工具,可以轻松地向 iOS 模拟器发送推送通知。
Poes 可以帮助你:
$ poes --help
OVERVIEW: A Swift command-line tool to easily test push notifications to the
iOS simulator
USAGE: poes <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
send Send a push notification to an app installed on the
iOS Simulator
$ poes send --help
OVERVIEW: Send a push notification to an app installed on the iOS Simulator
USAGE: poes send <bundle-identifier> [--title <title>] [--body <body>] [--badge <badge>] [--is-mutable] [--verbose]
ARGUMENTS:
<bundle-identifier> The bundle identifier of the app to push to
OPTIONS:
-t, --title <title> The title of the Push notification (default: Default
Title)
-b, --body <body> The body of the Push notification (default: Default
Body)
-b, --badge <badge> The number to display in a badge on your app’s icon
-i, --is-mutable Adds the mutable-content key to the payload
--verbose Show extra logging for debugging purposes
-h, --help Show help information.
bundle identifier 是强制性的,所有其他参数都有默认值。 以下命令足以发送一个通知
$ poes send com.wetransfer.app --verbose
Generated payload:
{
"aps" : {
"alert" : {
"title" : "Default title",
"body" : "Default body"
},
"mutable-content" : false
}
}
Sending push notification...
Push notification sent successfully
您可以使用 Mint 安装 Poes,如下所示
$ mint install AvdLee/Poes
cd
进入仓库swift package generate-xcodeproj
(生成一个用于开发的 Xcode 项目)swift run Poes --help
Poes 在荷兰语中是母猫的意思。 它的发音与 "Push" 相同,而推送通知正是我们在这里所做的事情!
这使得最终创建一个带有 UI 的 Mac 应用程序变得非常容易 🚀
请查看我的博客文章 在 Xcode 中创建 Swift Package 框架。
是的! 我写了一篇关于此的详细博客文章: 在 iOS 模拟器上测试推送通知