Skip to content



Feed module is used for sending In-App messages to your application. The module is handy if you wish your application users to retain the push notification they received for future reference.

Integration Steps

  • Add pod to Application's Podfile
    In pod file of your Application, add one line:
pod "streethawk/Feed"
  • Install Pod

In the OS X command line terminal, enter the following command (making sure that you’re in the directory containing your project and Podfile).

First time to install StreetHawk framework:

pod install

Next to check and upgrade to latest StreetHawk framework:

pod update

You should see output similar to the following.

Analysing dependencies
Downloading dependencies
Installing streethawk/Core (1.8.2)
Installing streethawk/Feed(1.8.2)
Generating Pods project
Integrating client project

This will automatically add StreetHawk/Core and StreetHawk/Feed open source code into your pod project, and configure everything ready for use.

Note: there is a bug in Cocoapods, which may cause error "No such file or directory". Solution: delete Pods folder and Podfile.lock file, run "pod install" again.

  • Request feed item from server

Call feed module's - (void)feed:(NSInteger)offset withHandler:(SHFeedsFetchHandler)handler API to request feeds from the server.

    [StreetHawk feed:0 withHandler:^(NSArray *arrayFeeds, NSError *error)
         dispatch_async(dispatch_get_main_queue(), ^
             if (error)
                 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Fetch feed error:" message:error.localizedDescription delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
                 [alertView show];
                 NSMutableString *strFeeds = [NSMutableString string];
                 for (SHFeedObject *feedObj in arrayFeeds)
                     //handle feed object, here is simply show in alert view
                     [strFeeds appendFormat:@"%@\r\n\r\n", feedObj];
                     [StreetHawk sendFeedAck:feedObj.feed_id];
                     [StreetHawk sendLogForFeed:feedObj.feed_id withResult:SHResult_Decline];
                 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Fetch feed(s):" message:strFeeds delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
                 [alertView show];
  • Notify user when new feed is available (Optional)

You can further notify users when a new feed item is available (sing badges or local notifications) by implementing @property (nonatomic, copy) SHNewFeedsHandler newFeedHandler; ..

    StreetHawk.newFeedHandler = ^
        //take action to request feed from server
  • Send feedack and feed result

Feedack is for reporting to server that a feed is received.

[StreetHawk sendFeedAck:<feed_id>];

Feed result is for reporting to server the feed result. The optional choices include: accept, ignore and decline.

[StreetHawk sendLogForFeed:<feed_id> withResult:SHResult_Decline];