ShareKit - How to Access Twitter Username

I have currently set up my application to take advantage of the XAuth implementation of Twitter services via ShareKit. Those who know about ShareKit and have implemented it in their own application, either for testing purposes or to add a huge array of services that it implements in your application, it will be good for you that we have SHKTwitter.h and .m and SHKTwitterForm.h and .m, which can be found in the Sharers folder in the source code.

It was here that I began to implement my own TwitLonger support for ShareKit. However, I ran into several problems. For those who have not used the TwitLonger API, they only need a Twitter username in order to actually send Tweet. However, I am trying to pull the Twitter username I entered from SHKTwitterForm.

Currently, talking to Nate (ShareKit developer), I have compiled this to pull the username key from NSMutableDictionary, save it to NSString and then save it to an NSUserDefault object. This is then called when my implementation of the TwitLonger API is implemented, creating a new NSString created from the NSUserDefault object.

In my SHKTwitter.m, I created a subclass of the form - (void) authorizationFormSave: (SHKFormController *) as directed by Nate. As you can see below, this is what I have.

- (void)authorizationFormSave:(SHKFormController *)form 
{

 NSMutableDictionary *dict = [form formValues];

 NSArray *keys = [dict allKeys];
 NSString *usernameString = [[keys valueForKey:@"username"] componentsJoinedByString:@""];


 [[NSUserDefaults standardUserDefaults] setObject:usernameString forKey:@"twitter_name_preference"];
 [[NSUserDefaults standardUserDefaults] synchronize];
}

, NSUserDefault NSString SHKTwitterForm.m, nil.

- , , ? , NSMutableDictionary. !

+3
1

valueForKey.

:

NSString *usernameString = [dict valueForKey:@"username"];
+1

Source: https://habr.com/ru/post/1773194/


All Articles