0

最近我正在做一个项目,它需要嵌入丰富的通知。所以我从火力基地接受服务。最初我从这些网站尝试过。并且在 youtube 中有一些爱好项目,他们从本地机器发送通知。

https://www.avanderlee.com/ios-10/rich-notifications-ios-10/

带有 UIImage 或远程 URL 的 UNNotificationAttachment

如何使用 Firebase 在 iOS 10 中实现丰富的通知

如何使用 swift 3 发送带有 firebase 推送通知的图像

但我花了将近 16 个小时。它给了我 0 输出,因为标题,副标题很好地来自 firebase,但没有图像图标的迹象。

请建议我任何方法或好的视频或其他东西。

4

1 回答 1

0

您的 App 目标的 plist 应包含以下行

<key>NSExtensionPointIdentifier</key> 
<string>com.apple.usernotifications.service</string> 
<key>NSExtensionPrincipalClass</key> 
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>

您的扩展程序的 plist 应如下所示

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>RemotePushExtension</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>XPC!</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.12</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.usernotifications.service</string>
        <key>NSExtensionPrincipalClass</key>
        <string>NotificationService</string>
    </dict>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Want to access your photo album to save image</string>
</dict>
</plist>
于 2017-10-03T12:40:16.933 回答