Don't want to tap twice to share message in Facebook using sharekit app?
I sharing message in Facebook by integrating sharekit in my iPh开发者_运维百科one application.I have written the method facebookButtonPressed
which I am calling on tapping one button.
First time when facebook screen is appearing its asking for authentication in Facebook . I have given userid and password of my Facebook existing account and tapped for login. Now the facebook authentication screen disappeared.Now again I tapped the button to call the methoed facebookButtonPressed
,then I got the message sharing screen.
I don't want to tap twice to get the message sharing screen.If any one has already solved this issue please help me.
-(void)facebookButtonPressed{
NSString* body = @"test body";
SHKSharer *fb = [[SHKFacebook alloc] init];
SHKItem *item = [[SHKItem alloc] init];
item.shareType = SHKShareTypeText;
item.text = [body length]>140?[body substringToIndex:139]:body;
fb.item = item;
if(![fb isAuthorized])
[fb authorize];
[fb tryToSend];
}
Try the below code, there will be action sheet to select how to share,you need to select Facebook.
NSString* body = @"test body";
SHKItem *item = [SHKItem text:body];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[actionSheet showFromToolbar:self.navigationController.toolbar];
Try to put the following:
item.shareType = SHKShareTypeText;
item.text = [body length]>140?[body substringToIndex:139]:body;
fb.item = item;
behind [fb tryToSend];
So that you first check whether fb is authorized and then share. Hope it helps.
精彩评论