0

Récemment, je travaille sur un projet et il est nécessaire d'intégrer une notification riche. Donc, je prends le service de Firebase. Au départ, j'ai essayé de ces sites. et il y a quelques projets de passe-temps sur YouTube où ils envoient une notification de la machine locale.Comment fournir Rich NotificationService (y compris l'icône d'image) à l'utilisateur?

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

UNNotificationAttachment with UIImage or Remote URL

How to implement rich notifications in ios 10 with Firebase

How to send Image with firebase Push Notification using swift 3

Mais près de 16 heures passées là-dessus. Il m'a donné 0 sortie parce que Title, sous-titre provenait finement de firebase mais il n'y a aucun signe d'icône d'image.

S'il vous plaît me suggérer une approche ou une bonne vidéo ou quelque chose.

+0

Vous devez créer NotificationService Extension. Télécharger l'image de la pièce jointe dans la classe d'extension et Mutuer le contenu de la notification. –

+0

Oui je l'ai fait et j'ai aussi ajouté mutable-content/mutable_content pour ça mais aucun signe de développement. – KhanShaheb

+0

Exécutez-vous la cible de votre application ou votre cible d'extension? –

Répondre

0

votre plist la cible App doit contenir les lignes suivantes

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

Et le plist de votre poste devrait ressembler à la suite

<?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> 
+0

Pouvez-vous dire que quelles lignes supplémentaires ajoutées dans NotificationServiceExtension plist? – KhanShaheb