mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
05/06/13 01:01 PM (12 years ago)

Scringo Custom URL to post in activity

Hey guys, I've gone through Scringo's documentation and a few different posts here in the forum, but I can't figure this out. I have some menus that link to Custom URL's with are youtube videos. I want to post to the activity wall "Matt just watched Video Bla bla bla". Anyone have any tips, done this before?
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/06/13 01:18 PM (12 years ago)
In the BT_screen_customURL.m I have this: #import <Scringo/ScringoAgent.h> [ScringoAgent postToFeed:@"Just watched a video"]; This posts to the wall, but I'm not sure how to get it to say specifically which video was watched (or technically which url screen was loaded) and make that linkable in the activity.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
05/06/13 02:25 PM (12 years ago)
Sorry, no idea, but I could make use of that also... My problem would be that I use customurl for several different outputs
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/06/13 02:30 PM (12 years ago)
Yeah that was going to be the second part to figure out :/
 
jvalley
Aspiring developer
Profile
Posts: 456
Reg: Feb 16, 2013
Green Bay,Wi
9,360
like
05/06/13 04:13 PM (12 years ago)
Mleonard Do you know how to do .. "User just visit ### page" to post in activity?
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/06/13 04:16 PM (12 years ago)
@jvalley No I do not...wish I did
 
jvalley
Aspiring developer
Profile
Posts: 456
Reg: Feb 16, 2013
Green Bay,Wi
9,360
like
05/06/13 04:17 PM (12 years ago)
Darn
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 08:42 AM (12 years ago)
Hi, I managed to make it but I'm not at my mac at the moment. I'll give you a starting point but I could be more precise later tonight or tomorrow: You can start with this. In your BTscreen custom url define the itemNickname to use: //get the itemNickname to use in Scringo Activity self.itemNickname = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"itemNickname" defaultValue:@""]; Then call the agent to post to feed: [ScringoAgent postToFeed:[NSString stringWithFormat:@"is watching %@", itemNickname] withImage:@"http://YOURIMAGEURL" withDescription:@"YOURDESCRIPTION" withSubDesc:@"" withActionVerb:@"Watch" withActionId:itemNickname]; The difficult part for me was later on to make the button clickable in the feed to let the users do the same action (for example watch the same youtube video). Don't worry, I managed to do it with the help of the community. :)
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 11:03 AM (12 years ago)
Thanks @Kahuna, I'll play with this more later. Post the rest when you can! Thanks again!
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 12:40 PM (12 years ago)
I added the code above and It's saying: "Property 'itemNickname' not found on object of type 'BT_screen_customURL' Maybe I should just wait til you can get to your mac.
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 12:52 PM (12 years ago)
Hi, did you add this? self.itemNickname = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"itemNickname" defaultValue:@""]; This should set the property "itemNickname"
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 12:56 PM (12 years ago)
In viewdidload add this: //get the itemNickname to use in Scringo Activity self.itemNickname = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"itemNickname" defaultValue:@""]; Add it before //appDelegate Then add this: //Scringo post to feed [ScringoAgent postToFeed:[NSString stringWithFormat:@"is watching %@", itemNickname] withImage:@"https://" withDescription:@"Do you like this video?" withSubDesc:@"Let us know it!" withActionVerb:@"Watch" withActionId:itemNickname]; Add it before //webView
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 01:04 PM (12 years ago)
In your menu.m (menu button.m for example if you're using the menu with buttons) import scringoagent then in viewwillappear add: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playClickedFromActivity:) name:kScringoNotificationActivityActionTapped object:nil]; and in viewdiddisappear add: [[NSNotificationCenter defaultCenter] removeObserver:self name:kScringoNotificationActivityActionTapped object:nil]; Last but not least: -(void)playClickedFromActivity:(NSNotification *)aNotification { NSLog(@"got watch button notification with video=%@", [aNotification userInfo]); NSString *watchvideo = [aNotification.userInfo objectForKey:@"action"]; NSLog(@"stringa=%@", watchvideo); for (id key in [aNotification.userInfo allKeys]) { NSLog(@"key: %@, value: %@", key, [aNotification.userInfo objectForKey:key]); } YOUR_appDelegate *appDelegate = (YOUR_appDelegate *)[[UIApplication sharedApplication] delegate]; appDelegate.rootApp.currentScreenData = self.screenData; BT_item *screenObjectToLoad = [appDelegate.rootApp getScreenDataByNickname:watchvideo]; [BT_viewControllerManager handleTapToLoadScreen:[self screenData] theMenuItemData:nil theScreenData:screenObjectToLoad]; [[NSNotificationCenter defaultCenter] removeObserver:self name:kScringoNotificationActivityActionTapped object:nil]; } Add this before //downloader delegate methods I hope it helped; please send some good karma as my app is in review right now :)
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 01:08 PM (12 years ago)
Thanks for trying to help...Yes, I've added both of those and here is what I get: https://dl.dropboxusercontent.com/u/51368344/screenshot_error.tiff
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 01:15 PM (12 years ago)
It makes sense; go to btscreencustomurl.h and add: @property (nonatomic, retain) NSString *itemNickname; right after @property (nonatomic) int didInit; I made it some weeks ago losing one night but I didn't remember all the steps :)
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 01:38 PM (12 years ago)
Haha no worries, I know how it is....trying to back track how you got something to work. I've put in everything from above and am now only getting this error: https://dl.dropboxusercontent.com/u/51368344/screenshot_error2.tiff Any ideas?
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 01:49 PM (12 years ago)
It happened to me once or twice. Try deleting itemNickname then type only the "i" and wait for xcode to "complete" the word "itemNickname", then press enter. That should fix it.
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 02:09 PM (12 years ago)
@Kahuna - Ok I think I'm close... It doesn't autocomplete, but it suggests that I change it to: _itemNickname If I do this, it gets rid of the errors and the activity shows up properly, but the "Watch" button in the feed crashes the app when clicked? Should it be working at this point?
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 02:48 PM (12 years ago)
It happened the same to me; it posted correctly but crashed when tapped on the activity. You've to add the "observer" for kScringoNotificationActivityActionTapped etc. I added the code some posts ago; you've to add it in your main menu screen code.
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 02:54 PM (12 years ago)
 
mleonard
Apple Fan
Profile
Posts: 124
Reg: Nov 01, 2011
Conway,AR
1,940
like
05/07/13 03:29 PM (12 years ago)
Ok gotcha, I pretty much have it working I think. Thanks so much for your help!
 
Kahuna
Apple Fan
Profile
Posts: 137
Reg: Nov 18, 2011
Milan
4,670
like
05/07/13 03:59 PM (12 years ago)
Glad I helped you. :)
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
08/10/13 04:26 PM (12 years ago)
@Kahuna or mleonard ..could you kindly help me out. I'm trying to add this to the quiz part of the app.. However, I'm have an issue when the actionid Play is clicked. It crashes the app. With: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString rangeOfString:options:range:locale:]: Range or index out of bounds' I've followed the above directions as well as the steps here: https://www.buzztouch.com/forum/thread.php?tid=0CF2EDE9E71A93C08E27CD3 I'm completely stumped. I've added the post to feed inside of the method: //viewDidLoad I've also added all of the observers etc. Did this crash like this for you before you figured it out? Thanks!!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.