PFTwitterUtils-NativeTwitter icon indicating copy to clipboard operation
PFTwitterUtils-NativeTwitter copied to clipboard

Request: Example class.

Open markdorison opened this issue 11 years ago • 2 comments

Is there any way you could provide an example class with the implementation as opposed to just the README? Thanks for the library!

markdorison avatar Nov 14 '13 19:11 markdorison

Hey Mark,

I don't have a sample app for this yet but in the future I may add one. Let me know if this helps you:

First make sure you import these files:

#import <Accounts/Accounts.h>
#import <Twitter/Twitter.h>
#import "PFTwitterUtils+NativeTwitter.h"

Then, when you want to start the sign in process you'll do something like this...

[PFTwitterUtils getTwitterAccounts:^(BOOL accountsWereFound, NSArray *twitterAccounts) {     
        // Let's just pretend the user selected the first account...
        // Normally, we would display these in a UIActionSheet or something...
        ACAccount *selectedAccount = [twitterAccounts objectAtIndex:0];

        // Give that account back to PFTwitterUtils and log in!
        [PFTwitterUtils logInWithAccount:selectedAccount];
    }];

That's it! You'll want to make sure you set a completion block so that you know when the sign-in finishes like this:

[PFTwitterUtils setNativeLogInSuccessBlock:^(PFUser *user, NSString *userTwitterId, NSError *error) {
    // Store user information...
}];

cconstable avatar Nov 14 '13 23:11 cconstable

@mstrchrstphr This was very helpful Thank you. I am having an authentication issue but I opened a separate ticket for that. #2.

markdorison avatar Nov 19 '13 22:11 markdorison