Fetch live-content in your app

This article provides steps on how you can fetch live-content from the Blueshift platform in your iOS app.

📘

Wait. Are you ready for this part?

In this article, we'll show you how you can use the SDK to send in-app messages with Blueshift. However, you cannot proceed until you already have the SDK in your project and you can use it in your app. In addition, we also need a .pem file to send notifications to your users. If you are not familiar with any of this, we recommend that you go through those articles first and then come back here.

We'll wait for you. No problem at all. :relaxed:

The SDK provides three different methods to fetch live-content from the Blueshift platform. You have to provide a slot name (for example, Editors_Picks_Json) with the API call to get its content.

Here's how to use the live-content methods that our iOS SDK provides:

#import <BlueShift-iOS-SDK/BlueShift.h>

[BlueShiftLiveContent fetchLiveContentByEmail:slotName success:^(NSDictionary *dictionary) {
    // deal with the response dictionary
} failure:^(NSError *error) {
    // handle error here
}];

[BlueShiftLiveContent fetchLiveContentByCustomerID:slotName success:^(NSDictionary *dictionary) {
    // deal with the response dictionary
} failure:^(NSError *error) {
   // handle error here
}];

[BlueShiftLiveContent fetchLiveContentByDeviceID:slotName success:^(NSDictionary *dictionary) {
   // deal with the response dictionary
} failure:^(NSError *error) {
  // handle error here
}];
import BlueShift_iOS_SDK

BlueShiftLiveContent.fetch(byEmail: "slotName", success: { (dictionary: [AnyHashable : Any]?) in
     // deal with the response dictionary
}, failure: { (error: Error?) in
    // handle error here
})
        
BlueShiftLiveContent.fetch(byCustomerID: "slotName", success: { (dictionary: [AnyHashable : Any]?) in
    // deal with the response dictionary
}, failure: { (error: Error?) in
   // handle error here
})
        
BlueShiftLiveContent.fetch(byDeviceID: "slotName", success: { (dictionary: [AnyHashable : Any]?) in
    // deal with the response dictionary
}, failure: { (error: Error?) in
    // handle error here
})

Did this page help you?