I am just trying to implement an iPhone app, that has a feature to share on Google+. So, when I click on share button, it is opening the link in safari. Instead, I would like to have it like Facebook pop-up window. Is there any possibility to implement it?
- (IBAction) didTapShare: (id)sender {
share = [[[GooglePlusShare alloc] initWithClientID:kClientID] autorelease];
/* share.delegate = self; // optional
appDelegate.share = share; //optional*/
[[[[share shareDialog] setURLToShare:[NSURL URLWithString:#"URL_TO_SHARE"]] setPrefillText:descStr] open];
[[share shareDialog] open];
}
This is the code, I’ve used for sharing. And I look up on the GooglePlusShare class, I couldn’t figure out anything possible. Thanks in advance!
I think , right now , this is the preffered way to post on google plus..And
After all. after posting status on google plus..it also comes back to your app..
Related
I'm developing a lockscreen application using theos and part of the functionality requires icon images of certain applications on the phone. How can I go about getting those icon images and displaying them on the lockscreen of the phone?
I've tried everything I could think of so far and have searched through the springboard headers with no luck. I've specifically been trying retrieving the images from SBApplication and SBIconModel from suggestions I found through google, but still I have no luck.
Any help is greatly appreciated. Thanks!
After you %hook a class, inside the method you're using, do the following if for example you're trying to get the icon for the mail app
// Get the SBApplication for the mail app
Class $SBApplicationController = objc_getClass("SBApplicationController");
SBApplication *mailApp = [[$SBApplicationController sharedInstance] applicationWithDisplayIdentifier:#"com.apple.mobilemail"];
// Get the SBApplicationIcon for the mail app
SBApplicationIcon *mailAppIcon = [[objc_getClass("SBApplicationIcon") alloc] initWithApplication:mailApp];
The important thing is to get the right DisplayIdentifier of the app you're interested in.
Hope this help! any problems please shout.
Although, I accept the above as the answer, I ended up using the following code, which displays titles and badges:
SBIcon *sbIcon = [model applicationIconForDisplayIdentifier:identifier];
SBIconView *app = [[%c(SBIconView) alloc] initWithDefaultSize];
[app setIcon:sbIcon];
//if you want the titles to be conditional
[app setLabelHidden:!titlesEnabled];
//if you want the badge view to be conditional
id badgeView;
if (device_version >= 6.0) badgeView = MSHookIvar<id>(app, "_accessoryView");
else badgeView = MSHookIvar<id>(app, "_badgeView");
if (badgeView) [badgeView setHidden:!badgesEnabled];
I downloaded the Facebook API for iPhone and put it in my project. I am searching all over the internet but can't seem to find out how to actually display the sign up/log in with Facebook buttons in an iPhone App. All the tutorials seem to miss this aspect.. I mean, do I need to find the button images myself from the web and manually add them to the app as buttons? Looking for something like this:
FBSignInButton* b = [[FBSIgnInButton alloc] initWithFrame:CGRectMake(x, y, width, heght)]
[self.view addToSubView:b];
that's it. Trivial right? How do I do it?
I dont think you need to show the button to login to facebook just use
_loginDialog = [[FBLoginDialog alloc] init];
[_loginDialog show];
when ever you think that the user should login to be given access to anything else in your app or something like to get the user info. before your app can do something with the users facebook account.
You can check the ray wanderlich tutorial on the same.
http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app
I hope this is what you are looking for.
I haven't used ShareKit much, but I want to have only three sharing options: Facebook, Twitter, and Email. ShareKit gives far more options, including a More button. However, I don't want the More option, just the three.
In SHKActionSheet.m of ShareKit:
// Add More button
[as addButtonWithTitle:SHKLocalizedString(#"More...")];
It is super easy now, if you use ShareKit 2.0.
edit SHKSharers.plist to include only sharers you need. In case you do not want to compile unused sharers files, check granular install.
You can hide "more..." button in configurator. The new setting is - (NSNumber*)showActionSheetMoreButton
You can disable favourites reordering in configurator. Normally last used sharer is on the top in ShareKit's action sheet. The new setting is - (NSNumber*)autoOrderFavoriteSharers
Using this way you do not need to change or add any code to ShareKit.
I wanted to have the same thing. I spent days to make ShareKit work without too much success. Ok I was able to post FB, Twitter and Email messages but it was more pain the convenience.
Sharekit is an awesome idea but:
You cannot share image, URL and text at the SAME TIME! It has to be
text only, URL only or Image only. Probably you want your user to
post something on FB or Twitter or send an email about your App.
What's the point if the message cannot contain an
App Store or webpage link?
Very badly documented often you have to post questions on
StackoverFlow
It's buggy, not supported by the original designer so there are dozens of forks. You can pick the ShareKit fork, but still.
On it's website it sounds like it's a drag and drop and you can make it work in minutes, good luck for that.
It takes 5 lines to add twitter, about 50 for Facebook and email to support text, URL and photo at the same time.
Twitter: This code sends a message with User editable text, URL (hidden, not editable) and an image. It took me 5 minutes to figure it out.
#import <Twitter/TWTweetComposeViewController.h>
- (IBAction)twitterButton:(id) sender {
TWTweetComposeViewController *tweetView = [[TWTweetComposeViewController alloc] init];
[tweetView setInitialText:#"Check out this app, it's awesome" ];
[tweetView addImage:[UIImage imageNamed:#"MyImage.png"]];
[tweetView addURL:[NSURL URLWithString:appDelegate.appStoreURL]];
[self presentModalViewController:tweetView animated:YES];
}
I really appreciate the effort of creating Sharkit but personally I cannot recommended it unless you really need to support all of those sharers and you happy with limited functionality.
UPDATE:
I implemented Facebook sharing myself. It was more difficult than I thought. The main problem is that you cannot upload a photo with a post because Facebook only accept image links. Even worse Facebook does not allow to link to a photo which is uploaded to the user photo album (very easy) as it must be an external link. For static images you can use a URL shortener to get around it but for user generated images pretty much you have to use Amazon S3 or something else. Amazon S3 is super easy to use, I figured out how to use upload files in an hour or so.
If you don't want the More... button, why don't you take out the line of code that adds it?
you need to make this code changes from SHKActionSheet.m
+ (SHKActionSheet *)actionSheetForType:(SHKShareType)type
// Add More button
//[as addButtonWithTitle:SHKLocalizedString(#"More...")];
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
// More
// else if (buttonIndex == sharers.count)
// {
// SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc]
// initWithStyle:UITableViewStyleGrouped];
// shareMenu.item = item;
// [[SHK currentHelper] showViewController:shareMenu];
// [shareMenu release];
// }
And you can edit SHKSharers.plist for services you like.
you can use the below definition for dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
you need to delete the few lines which is commented in the below definition.
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
{
// Sharers
if (buttonIndex >= 0 && buttonIndex < sharers.count)
{
[NSClassFromString([sharers objectAtIndex:buttonIndex]) performSelector:#selector(shareItem:) withObject:item];
}
// More
//else if (buttonIndex == sharers.count)
// {
// SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc] initWithStyle:UITableViewStyleGrouped];
// shareMenu.item = item;
// [[SHK currentHelper] showViewController:shareMenu];
// [shareMenu release];
// }
[super dismissWithClickedButtonIndex:buttonIndex animated:animated];
}
Excellent solution, however in my case for example want to use Facebook as well and there is no way to share content natively in iOS5. Another problem is that those who need the app compatible with iOS4.0 or higher (my case) can not, because this method only works from 5.0.
How to solve this? ShareKit to Use Facebook and Twitter for the native methods and forget about compatibility with iOS4.0?
I am using ShareKit plugin for iPhone to enable social sharing for the application I'm working on. I set up everything, I stripped it to have Facebook and Twitter services only, connected successfully to both and now I have 1 problem in each of the services...
The problem with Twitter is how to logout/signout...
ShareKit sends the text and the url to Twitter's publish box. It is saving status perfectly. The question is where to put "logout" button for twitter? I want the iPhone user to logout in order to change username. This is done by calling the method
[SHKTwitter logout];.
Now, the problem is where to put the button that will fire this method? In navigationToolbar of Twitter actionSheet I already have 2 buttons and the toolbar (bottom one) is covered by the keyboard?
[EDIT]: I solved this issue by modifying the twitter action sheet. I resized the textView and then added UIToolbar and changed its position so that it fits into the gap between the keyboard and textView. Into the toolbar I added one button with an action that calls a logoutTwitter method
Facebook problem is more of a mystery...
So, in my sharreKitButtonHandler I have the following code:
NSURL *url = [NSURL URLWithString:#"http://www.domain.com"];
SHKItem *shareItem = [SHKItem URL:url title:self.itemTitle.text];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:shareItem];
[actionSheet showFromToolbar:self.shareKitToolbar];
This code prepares some ivars of a shareItem object and in the case of Twitter shareKit manages to fill the status box so that user just needs to press publish and its done...
In the case of Facebook it is not working. FB dialog pops out and the share box is empty saying "What's on your mind?" The url and the title are not put into the publish form?
So, please if you have any clue what's going on in the latter problem or how to solve the former problem, I would really appreciate your help...
It takes five lines to add twitter. I wouldn't bother with Sharekit for that.
TWTweetComposeViewController *tweetView = [[TWTweetComposeViewController alloc] init];
[tweetView addImage:imageToShare;
[tweetView addURL:URLToShare];
[tweetView setInitialText:messageToShare];
[senderViewController presentViewController:tweetView animated:YES completion:nil];
I wanted to use sharekit for my projects, but it was difficult to use and after a week I gave up as I couldn't share more than one thing at the same time (URL, Image, Message, etc.) which is pretty useless if you want to promote your app.
Facebook is more difficult, probably a 100 lines. It took me 3-4 days to implement. It will be integrated in iOS 6 just like Twitter :)
We have a wifi hotspot that displays a terms of service page before people are allowed to start using it.
After acceptance, a new page with a few links is displayed. I'd like to have those links open in Safari instead of in UIWebView.
I know there's a way to program UIWebView to open links in Safari, but that's not an option as this is the default UIWebView for logging into wifi hotspots and not a custom app.
Is there another way to have the links open in Safari and not in UIWebView? I've tried javascript and I've tried setting the target to _blank.
EDIT: After reading some responses, it seems like the only way to do this is to set the UIWebView delegate. I don't think this is an option because I'm not the one launching the UIWebView.
When the iPhone connects to the network (at least with version 3.0), it checks to see if it's being redirected to a login page. If it is, it does what you're saying with authentication and such inside of a UIWebView. Have you checked to see what it's reporting as the browser in use? If it isn't Mobile Safari, then you could do something server-side the first time someone connects using Mobile Safari.
If it does report as Mobile Safari when it's checking redirection, then another alternative is to figure out what site it tries to go to - maybe apple.com? Then, on the server side, the first time a different URL is loaded, redirect to your links. This will only work when the user opens Mobile Safari, however.
Other than that, I think what you're asking to do is outside of the scope of the current iPhone OS. I'd recommend filing a ‘feature request’ with Apple at bugreport.apple.com.
The only way I know how to do this is to set up a UIWebView delegate and supply something like the following:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
if (navigationType == UIWebViewNavigationTypeLinkClicked &&
[request.URL isFileURL] == false)
{
[[UIApplication sharedApplication] openURL:request.URL];
return NO;
}
return YES;
}
The code above will cause Safari to open a link clicked on by the user. I know you said you had little control over this UIWebView -- perhaps you have more than you think by setting the delegate?
Use the openURL method of UIApplication:
NSURL *url = [[NSURL alloc] initWithString:#"http://example.com"];
[[UIApplication sharedApplication] openURL:url];
[url release];
An Apple example of this is available as part of the LaunchMe sample.