Search code examples
iphoneiosfacebooksocial-media

Facebook and twitter auto share to user account?


I want to auto share a social media user account's from My iPhone application(without dialog box, cancel option , send option).how can I do.


Solution

  • instead of using dialog box, share your stuff using doGraphPost

    Use this method to share on fb without opening dialog box

     <FbGraphResponse_Obj> = [fbGraph doGraphPost:@"me/feed" withPostVars:<NSMutableDictionary>];
    

    Find here in detail:

    // Invoke fbGraphCallback & prepare fbArray..
    
    // preapare conent to be posted, add following snippet in same function
    
        NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];
        [variables setObject:@"Yours content to be shared" forKey:@"message"];
    
    
        // share prepared content to fb
        fb_graph_response = [fbGraph doGraphPost:@"me/feed" withPostVars:variables];
        NSLog(@"postMeFeedButtonPressed:  %@", fb_graph_response.htmlResponse);
    
    
    where fb_graph_response is an instance of FbGraphResponse
    

    Enjoy Programming!!