Rich Push Notification image Not Showing For IOS 10.

Hello,

I have implemented Urban airship SDK for handling push notification. Using This Urban airship Implementation Guide.

"http://docs.urbanairship.com/platform/ios.html" 

 

But am Unable to show Images on notification.

 

Here is the payload which am getting from Server.

 

{
"_" = "channel_id";
aps = {
alert = {
body = testing;
title = "Boys and Girls club of Boston";
};
"mutable-content" = 1;
};
"com.urbanairship.media_attachment" = {
options = {
crop = {
height = "0.2";
width = "0.2";
x = "0.1";
y = "0.1";
};
time = 10;
};
url = (
"http://ladgbucket.s3.amazonaws.com/dev/users/1484421361file.jpeg"
);
};
"post_id" = 1;
"post_type" = news;
url = "http://ladgbucket.s3.amazonaws.com/dev/users/1484421361file.jpeg";
}

 

Didn't find what you were looking for?

New post

Comments

37 comments

  • Hi mishra,

    Just to be absolutely clear, have you made sure that the Notification Service Extension is implemented properly in your iOS 10 app?

    If that is not implemented properly, that could result in the image not showing up.

     

    Comment actions Permalink
    0
  • Yes, i have implemented extension class which inherits 

    UAMediaAttachmentExtension but its not working.

    Comment actions Permalink
    0
  • mishra,

    Okay.

    Next, you'll want to make sure your image is hosted on via HTTPS.

    iOS only supports content coming from a secure source, so if it is not coming from a secured source, it may not show up.

    Comment actions Permalink
    0
  • Hello Support,

    I’m facing one issue while rich push notification for PNG or other image format. I tried with HTTPS as well but only GIF image of 150x150 size working properly. Please let me know is there any size or formate restriction on rich push notification via urban airship ? We have tried other size as well. Please find below sample image, which not working for rich push.

    https://ladgbucket.s3.amazonaws.com/stage/organization/1487770467logo.png

    Comment actions Permalink
    0
  • mishra,

    For iOS Media Attachments, you can see the format and size specifications in our API Reference docs.

    A .PNG file should work, assuming the size of the file meets Apple's specifications. Do you know what size of file you were using?

    Comment actions Permalink
    0
  • I am having this issue as well. Doing this from the composer and the image is a png file at an https url.  Works perfect on Android but iOS 10 shows the message without the image.  I am using the Cordova plugin btw.

    Comment actions Permalink
    0
  • Ty,

    For Cordova, you'll want to make sure you've followed the Installation guide, specifically for adding the Notification Service Extension to your project. Without that extension, you'll be unable to receive and show rich media notifications on iOS 10.

    Comment actions Permalink
    0
  • Were you guys be able to have a solution for this? I'm having the same problem. I already implemented the extension class which inherits  UAMediaAttachmentExtension. I'm Sending a https image. I'm linking the extension to the app in Build Phases - EmbedAppExtensions. Essentially when you create the Notification Services Extension, the app links the extension for you. Am I missing something? 

    Comment actions Permalink
    0
  • Andres,

    We've definitely noticed some hiccups when sending certain images to the device.

    Would you be able to link us to the image you were using to send in the notification? If not, try uploading the image to a source like imgur and use the source link from there and see if that makes a difference at all.

    Comment actions Permalink
    0
  • Hi Michael,

    This is the image I'm using to test my push notifications: https://www.shaw.ca/uploadedImages/Television/Shaw_Go/TSN/tablet-screen1.jpg. 

     

    If you can let an image that you know that it works to me would be great. 

     

    Comment actions Permalink
    0
  • Comment actions Permalink
    0
  • Andres,

    I was able to test that image, and it showed up on my iOS 10 device. That means that the image itself appears to be fine.

    Now, we'll just need to check your implementation of the Notification Service Extension. Just to make sure, your app's target "Embed App Extensions" contains your service extension, correct?

    Comment actions Permalink
    0
  • Hi Michael, 

    Yes, My app's target "Embed App Extensions" does contain the service extension. By default Xcode does that when you create the service extension.  I double-checked that in Xcode Project -> Build Phases -> Embed App Extensions and it's equal as the configuration in this image. https://docs.urbanairship.com/images/embed-extension-in-app.png . I got this from the Urban Airship guide for add the Extension: https://docs.urbanairship.com/platform/reference/ios-extension/ .

    Comment actions Permalink
    0
  • Hi Michael, if I'm receiving the notification, but without the image, can I assume I did follow correctly the guide(https://docs.urbanairship.com/platform/ios/  ) to integrate AirShip in my application? Can I assume the error is in the steps to integrate the Notification Service Extension of this guide: https://docs.urbanairship.com/platform/reference/ios-extension/ ? 

    Comment actions Permalink
    0
  • Andres,

    The Notification Service Extension is not needed to receive notifications. It is, however, needed in order to support images in notifications on iOS 10.

    In order to rule out the service extension setup, can you try sending a notification with this image for the media attachment?

    https://placekitten.com/480/450

    If that image doesn't work, then we know that it's an issue with the setup rather than the image itself.

    Comment actions Permalink
    0
  • Hi, At the end I did everything again and now it works. So I don't know what was the error, but following the steps it works. Also the size of the image was important, if you can provide me the specifications for the allowed images it would be helpful. 

    Thank you Michael.

    Comment actions Permalink
    0
  • Andres,

    The Media Attachment specs can be found in our API Docs. This will include specs for images, video, audio, and gifs.

    Comment actions Permalink
    0
  • I am also using cordova and am having the same issue. The picture does not show up, as it seems the extension does nothing. I have 

    1) added the notification service extension as described 

    2) am using the cat image recommended below: https://placekitten.com/480/450

    I know the notification service is installed correctly because when I use default NotificationServiceCode with didReceive as below, I can modify the notification title:


    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
      self.contentHandler = contentHandler

    if let bestAttemptContent = bestAttemptContent {
      bestAttemptContent.title = "\(bestAttemptContent.title) [modifiedddddd]" 

      contentHandler(bestAttemptContent)
    }
    }

     

    When I change it to the recommended code, the extension does nothing.

    import AirshipAppExtensions
    class NotificationService: UAMediaAttachmentExtension {}

    Is the UAMediaAttachmentExtension not updated for ios 11?

    Comment actions Permalink
    1
  • BTW, in my case, I fixed this by setting the Service Extension target.  It will automatically set this to the latest release.  If the device you are testing on is less than that target then you will not see images.  

    Comment actions Permalink
    0
  • So for both the main target and the Service Extension Target, I have a deployment target of 11.0, and am testing on an iphone 8 on 11.3:


     

    Is there anywhere else I need to set it other than in the "General" tab? Could be wrong, but I think the service extension target is correctly getting included because if I use the skeleton code that Xcode provides, I can modify the notification title.

     

     

    Comment actions Permalink
    0
  • Pete, that is correct.  You set it in the target for the Notification Extension under the General tab for that target.  Make sure you have that target selected in xcode and go to General.

    Comment actions Permalink
    0
  • Note that in xcode I see the info line:

    [D] +[UAActionRunner runActionWithName:value:situation:metadata:completionHandler:] [Line 60] No action found with name com.urbanairship.media_attachment, skipping action.

    I actually saw this before I even added the extension, but clearly I should not be seeing it. It would seem that the UAMediaAttachmentExtension does not implement the latest notification API. Anyone else have this issue?

    Comment actions Permalink
    0
  • Pete,

    Do you happen to know which version of the plugin you're using? It should just work. The only other thing I can think of is either that action got left out for some reason, or the app isn't actually building the service extension. 

    Comment actions Permalink
    0
  • Hi Michael,

    Thanks for the help. I am using the latest versions:

    urbanairship-cordova 7.0.1

    pod 'UrbanAirship-iOS-AppExtensions', '9.1.0'

    The app does seem to be building the service extension. Before I replace the ios dummy code with just  "class NotificationService: UAMediaAttachmentExtension {}" , I can modify the notification by overriding didReceive. 

     

    But when I just extend UAMediaAttachmentExtension, nothing seems to happen. The build does error if I spell the extension incorrectly, so it does seem that xcode is at least building the file.

    It seems though that either the action is not being overridden correctly by the extension, or it's simply not included (seems to be the first).

    The deployment target for both targets is 11.0, and my phone is 11.3 so I think that's not an issue.

     

    Comment actions Permalink
    0
  • Pete,

    Could we check the podfile?

    Is it using the use_frameworks! line for the AirshipAppExtensions?

    target "SampleExtension" do
    use_frameworks! pod 'UrbanAirship-iOS-AppExtensions' end
    Comment actions Permalink
    1
  •  

    Michael,

    You are amazing. The image appears after I edited my Podfile to look like:

    platform :ios, '11.0'
    target 'MyApp' do
        use_frameworks!
        pod 'UrbanAirship-iOS-AppExtensions', '9.1.0'
    end

    It didn't have the "use_frameworks!" line in it before. I am use a cordova plugin for cocoa pods (https://github.com/blakgeek/cordova-plugin-cocoapods-support) so the file was being autogenerated. 

    Really appreciate the patience and help here!

     

    Comment actions Permalink
    0
  • Happy to help!

    Comment actions Permalink
    0
  • hello mr/Michael Halka   can you help me to  view image in notification ios    using ionic4

     

    Comment actions Permalink
    0
  • Hi Mohamed,

    The Ionic Platform should follow pretty much the same steps as our Cordova plugin to set up a Notification Service Extension.

    https://docs.airship.com/platform/ios/getting-started/#notification-service-extension

    Have you already given this a try?

    Comment actions Permalink
    0
  • can i use UrbanAirship-iOS-AppExtensions   with  firebase notification ?

    Comment actions Permalink
    0

Please sign in to leave a comment.