Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 17    Views: 161

MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
06/10/12 10:30 AM (13 years ago)

Socialize and RSS Titles

Hi Gang, After an extremely busy three months, I'm back and working on some app upgrades. I've been integrating Socialize into an app, and everything is working fine except for one area. Once an rss feed opens an article in the webview, I can't seem to get the title shared with Socialize. I can pick up and share the url without any problem. To utilize Socialize with the rss, I've had to add the following to my BT_screen_webView.m (in the bt_screen_rssReader folder): self.actionBar = [SocializeActionBar actionBarWithKey:useURL name:xmlItemTitleName presentModalInController:self]; [self.view addSubview:self.actionBar.view]; I've tried adding and passing several variables such as "xmlItemTitleName" and "Title" by first adding the NSString declaration and the property and synthesize statements. But no luck. The Socialize example uses @"Something" but I need a variable so it matches the title of the rss article. Any ideas?
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/10/12 08:25 PM (13 years ago)
For anyone who is following this, I figured it out (thanks to google). Here's the code I used and it's working great: NSString *shareTitle = [[NSString alloc] init]; NSData *htmlFile = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:useURL]]; NSString *htmlString = [[NSString alloc] initWithData:htmlFile encoding:NSUTF8StringEncoding]; NSArray *substrings = [[NSArray alloc] init]; substrings = [htmlString componentsSeparatedByString:@"<TITLE>"]; if ([substrings count] < 2) { substrings = [htmlString componentsSeparatedByString:@"<title>"]; } if ([substrings count] > 1) { NSString *rightPart = [substrings objectAtIndex:1]; substrings = [rightPart componentsSeparatedByString:@"</TITLE>"]; if ([substrings count] < 2) { substrings = [rightPart componentsSeparatedByString:@"</title>"]; if ([substrings count] < 2) { shareTitle = [NSString stringWithString:useURL]; } else { shareTitle = [substrings objectAtIndex:0]; } } else { shareTitle = [substrings objectAtIndex:0]; } } else { shareTitle = [NSString stringWithString:useURL]; } self.actionBar = [SocializeActionBar actionBarWithKey:useURL name:shareTitle presentModalInController:self]; [self.view addSubview:self.actionBar.view];
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
06/11/12 07:01 AM (13 years ago)
great to see you back. going thru your game center tutorial was one of the best study guides i've used to extend BuzzTouch a bit. wanted to remember to thank you for that. i just started looking at Socialize. loved that targeted form feature someone posted the other day. but I'm iffy on the socialize "Action Bar". are you using it in your app? I really liked their Push Notifications/Smart Alerts feature, those look nicer than most i've seen. See,s you can incluse an image with the alert. Thinking of trying to just utilize just this feature. I have read thru most of the basic documentation and i can't tell yet if i'd just be able to use that feature from the SDK without the Action Bar. I'm sure they want you to use the bar - but if i don't have to....
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/11/12 07:05 AM (13 years ago)
Thanks. I've got the action bar functioning in a test app at the moment. I wanted to limit it to only certain screens -- mainly the rss feed page -- and am working to figure that out. I've got it working well on the rss page and working on the image gallery page at the moment. The push notifications looks interesting -- especially with the ability to micro target. That will come next. I plan on putting a tutorial together for this once I've got it working.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
06/11/12 07:17 AM (13 years ago)
Hi MGoBlue, Thanks for your code. I'm currently testing socialize too. Would be nice if you could share a nice tutorial on this. Just using your (plain) code doesn't work Best Regards, Danny
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/11/12 07:25 AM (13 years ago)
Danny, I will get a tutorial together. You're correct, just the code above doesn't work. This is only for the rss page. You still need to have reference to socialize in the app delegate and other spots. Tutorial coming soon (once all my testing is done). Jeff
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
06/11/12 07:30 AM (13 years ago)
MGoBlue, Would be very nice. I know that only add your code will not work. I'm able to get socialize on any (seperate) screen/plugin I want. So I have the reference in the delegate. But still your code doesn't work. Love to have the feature to share or comment on each article seperately. will wait for your tut. Thanks in advance, Best Regards, Danny
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/11/12 07:35 AM (13 years ago)
Danny, In the BT_screen_webView.m file within the bt_screen_rssReader folder, search for the following: if([self.dataURL length] > 3){ //merge possible variables in URL useURL = [BT_strings mergeBTVariablesInString:self.dataURL]; } Place this code directly after this section. NSString *shareTitle = [[NSString alloc] init]; NSData *htmlFile = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:useURL]]; NSString *htmlString = [[NSString alloc] initWithData:htmlFile encoding:NSUTF8StringEncoding]; NSArray *substrings = [[NSArray alloc] init]; substrings = [htmlString componentsSeparatedByString:@"<TITLE>"]; if ([substrings count] < 2) { substrings = [htmlString componentsSeparatedByString:@"<title>"]; } if ([substrings count] > 1) { NSString *rightPart = [substrings objectAtIndex:1]; substrings = [rightPart componentsSeparatedByString:@"</TITLE>"]; if ([substrings count] < 2) { substrings = [rightPart componentsSeparatedByString:@"</title>"]; if ([substrings count] < 2) { shareTitle = [NSString stringWithString:useURL]; } else { shareTitle = [substrings objectAtIndex:0]; } } else { shareTitle = [substrings objectAtIndex:0]; } } else { shareTitle = [NSString stringWithString:useURL]; } self.actionBar = [SocializeActionBar actionBarWithKey:useURL name:shareTitle presentModalInController:self]; [self.view addSubview:self.actionBar.view]; That should work.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
06/11/12 07:45 AM (13 years ago)
Thanks MGoBlue, That did the trick. I was pasting in the wrong place. wonderfull. Many thanks for this. Best Regards, Danny
 
tonycelestino
Aspiring developer
Profile
Posts: 213
Reg: Jun 24, 2011
Maceio
4,080
like
06/14/12 06:24 PM (13 years ago)
Hey MGoBlue, I used Socialize on a non-BT app I had, just for testing I took it out before publishing the app because it doesn't offer any translation :( I'm building a couple of english apps in BT right now and it would be great to add socialize to them. I will give it a try and let everyone know how its going. Thanks for the info shared so far. =)
 
tonycelestino
Aspiring developer
Profile
Posts: 213
Reg: Jun 24, 2011
Maceio
4,080
like
06/14/12 07:33 PM (13 years ago)
What BT version are you guys talking about?
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/30/12 08:43 AM (13 years ago)
I'm using self-hosted 2.0.
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
07/08/12 04:03 PM (13 years ago)
Any updates on the Socialize tutorial?
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
07/20/12 03:40 AM (13 years ago)
Hey @GoBlue, @Danny, Would you mind having a look at something for me. I've began implementing Socialize step by step following both the get socialize PDF and info from another BT forum. Ive installed the sdk, frameworks, libraries and linker files. When i install steps 1 and 2 of the code into my App_Delegate.m file and run, i'm getting 9 errors. Can you let me know if I've installed it in the right location. Thanks Anthony http://dl.dropbox.com/u/35241128/Sample%20Screenshot/Socialize%20Error%20Log.png http://dl.dropbox.com/u/35241128/Sample%20Screenshot/appdelegate%20m%20errors.png http://dl.dropbox.com/u/35241128/Sample%20Screenshot/appdelegate%20m%20erros%202%20.png
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
07/20/12 12:40 PM (13 years ago)
Hi Rad Doc, Don't know if I can help but.... 1st screenshot: on line 64 you imported the socialize header file for the 2nd time delete that line. Also get rid (delete) line 72, 73, 74 and 75 Think you problems will go then. Hope it helps. Best Regards, Danny
 
xtremeesolutions
Code is Art
Profile
Posts: 106
Reg: Nov 19, 2011
FootHill Ranch,...
6,610
like
12/27/12 01:46 AM (13 years ago)
I am just trying to integrate socialize in my android application. Would be nice if you could share a nice tutorial on this. Just using a instruction guide from socialize , but doesn't work . waiting......
 
Uelsimon
Lost but trying
Profile
Posts: 272
Reg: Mar 25, 2012
NYC
4,470
like
02/23/13 05:30 PM (12 years ago)
tried to get this to work, but get an error on this line: "[self.view addSubview:self.actionBar.view];" that states 'Property 'view' not found on object of type 'SZActionBar *'. Any thoughts?
 
shak77
buzztouch Evangelist
Profile
Posts: 399
Reg: Jan 18, 2011
location unknow...
7,240
like
08/07/13 03:27 PM (12 years ago)
Hi, I have the Socialize bar working but it is showing on all of my screens even though it is only in RSS webview.m file. Anyone know how to fix this? Thanks, David
 

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.