Get Twitter Members list - ios

I m trying to get the list of the members of the group iOS Developers from Twitter Groups.
I m using STTwitterAPI. I used it to get the news feed of specific account, and it works so fine.
But when i tried to get the list of the members by using the functions (getListsMembersForSlug or getListsMembersForListID) it didn't work, I get the following error :
Description : Error Domain=STHTTPRequest Code=404 "The operation
couldn’t be completed. (STHTTPRequest error 404.)"
The code I m using is :
STTwitterAPI *twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:#"MyConsumerKey" consumerSecret:#"MyconsumerSecret"];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
NSNumber *t = [NSNumber numberWithInt:1];
[twitter getListsMembersForSlug:#"iOS Developers" ownerScreenName:#"Gadget_Ry" orOwnerID:nil cursor:false includeEntities:false skipStatus:t successBlock:^(NSArray *users, NSString *previousCursor, NSString *nextCursor) {
NSLog(#"Ok");
} errorBlock:^(NSError *error) {
NSLog(#"NOk");
}];
} errorBlock:^(NSError *error) {
NSLog(#"%#", error.debugDescription);
}];
Can anyone help me please? Any suggestions! Tutorials! I'll be grateful :)

iOS Developers is not a slug.
iOS-Developers is a slug.
:-)

Related

iOS linkedin share not working

I could not make work the new linkedin sdk. It just open the login view. When i logged in then it go to linked in account/profile rather then showing the share prompt. Do anyone have any blog or example with latest sdk ?
It just wasted my 3 days. Please help.
NSArray *permissions = [NSArray arrayWithObjects:LISDK_W_SHARE_PERMISSION, nil];
[LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState)
{
NSLog(#"%s","success called!");
NSString *url = #"https://api.linkedin.com/v1/people/~/shares";
NSString *payload = #"{\"comment\":\"Check out developer.linkedin.com! http://linkd.in/1FC2PyG\",\"visibility\":{ \"code\":\"anyone\" }}";
if ([LISDKSessionManager hasValidSession])
{
[[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload
success:^(LISDKAPIResponse *response)
{
// do something with response
NSLog(#"response : %#",response.data);
}
error:^(LISDKAPIError *apiError) {
// do something with error
NSLog(#"error: %#",apiError);
}];
}
}
errorBlock:^(NSError *error){
NSLog(#"%s","error called!");
}];
//
I'm facing the same issue.This is an effective method but not a good idea: UIApplication.sharedApplication().openURL(NSURL(string: "https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn")!)
If you successfully share something via the SDK for iOS,please let me know.
Just use a URL like this and hyperlink your share button/icon/text...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Source: Microsoft LinkedIn Share URL Documentation.
For example, this works for me:
https://www.linkedin.com/sharing/share-offsite/?url=http://www.wikipedia.org/
Works fine:

STTwitter return nil iOS

I'm using STTwitter Library (latest version) and trying to get tweets with authenticating by oAuth and specifically using the Application Only authentication which provide the bearer token.
I used the example code provided on GitHub but I do not getting neither success or error on the log out. This is my code :
STTwitterAPI *twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:#"XXX"
consumerSecret:#"XXX"];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
[twitter getUserTimelineWithScreenName:#"sttwitter"
successBlock:^(NSArray *statuses) {
NSLog("successBlock : ", statuses);
} errorBlock:^(NSError *error) {
NSLog("errorBlock : ", error);
}];
} errorBlock:^(NSError *error) {
NSLog("errorBlock : ", error);
}];
Any help will be appreciated. I'm unable to find other twitter library specially for the api v1.1.

STTwitter CFNetwork internal error NSURLRequest

After looking at this link API mode error I corrected some code using STTwitter. This eradicated one error but made me notice a new CFNetwork error. Whenever I try to fetch statuses using either getHomeTimelineSinceID or getUserTimelinewithScreenName, the error "CFNetwork internal error (0xc01a:/SourceCache/CFNetwork/CFNetwork-695.1.5/Foundation/NSURLRequest.mm:798)" pops up in the debugger. After debugging I found the error pops right after [r Asynchronous] (line 272 of STTwitterAppOnly.m). I got to this spot by stepping into verifyCredentialsWithSuccessBlock.
The code I am currently using:
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
[twitter getHomeTimelineSinceID:nil
count:20
successBlock:^(NSArray *statuses) {
NSLog(#"-- statuses: %#", statuses);
self.twitterFeed = statuses;
[self.tableView reloadData];
} errorBlock:^(NSError *error) {
}];
And I have also tried:
[twitter getUserTimelineWithScreenName:#"Dandelion_2014"
successBlock:^(NSArray *statuses) {
self.twitterFeed = [NSMutableArray arrayWithArray:statuses];
[self.tableView reloadData];
} errorBlock:^(NSError *error) {
NSLog(#"%#", error.debugDescription);
}];
I'm not sure what is causing this error, does anybody have insight?
I think I found the issue.
iOS 8 raises a runtime warning when setting -[NSURLRequest HTTPMethod] to nil.
I updated STHTTPRequest and STTwitter.
Let me know if it works for you.

Simple twitter timeline iOS (only read tweets for no register user)

I want a twitter timeline to be displayed in a View, without the user having to put your twitter account, simplemete read the tweets and hashtag, of the accounts that I have selected during the programming of the app.
Is it possible? Where do I can find info for this?
All I see includes login in twitter.
Thank you.
You can use STTwitterAPIWrapper
Firstly using Twitter you must create an app , because you must use key and secret of your app in the code.
For example :
STTwitterAPIWrapper *twitter = [STTwitterAPIWrapper twitterAPIApplicationOnlyWithConsumerKey:YourTwitterConsumerKey
consumerSecret:YourTwitterConsumerSecret];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *username)
{
NSDictionary *parameters = #{#"q" : #"anyHashTag", #"result_type": #"recent", #"count": #"100"};
[twitter getSearchTweetsWithQuery:parameters successBlock:^(NSDictionary *searchMetadata, NSArray *statuses, NSString *refreshUrl) {
_refreshUrl = refreshUrl;
[self parseJSONString:statuses];
} errorBlock:^(NSError *error) {
//NSLog(#"-- error: %#", error);
}];
} errorBlock:^(NSError *error) {
//NSLog(#"--** error %#", error);
}];

STTwitter Library returns an error when getting tweets list for keyword with special characters

I want to get tweets list using Twitter Search API. But Recently twitter has launched New version-1.1 and it requires authorization. I'm using STTwitter library for interacting with Twitter API.
I'm using STTwitter_ios project which you can find from here :
https://github.com/nst/STTwitter/tree/master/ios
Now, I have written one sample function: fetchTweets. Authorization works successful and I'm getting the list if i search for the word (Without spaces or special characters). But When I try to search keyword with spaces or Special characters like "New york", #"New or York", etc.. then it returns error :
In the method ,
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
I'm getting error :
{"errors":[{"message":"Could not authenticate you","code":32}]}
- (void) fetchTweets {
STTwitterAPIWrapper *twitter = [STTwitterAPIWrapper twitterAPIWithOAuthConsumerName:OAUTH_CONSUMER_NAME consumerKey:OAUTH_CONSUMER_KEY consumerSecret:OAUTH_CONSUMER_SECRET oauthToken:OAUTH_TOKEN oauthTokenSecret:OAUTH_SECRET_TOKEN];
NSString *query = #"New york";
NSString *searchQuery = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[twitter getSearchTweetsWithQuery:searchQuery successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
NSLog(#"Search data : %#",searchMetadata);
NSLog(#"\n\n Status : %#",statuses);
} errorBlock:^(NSError *error) {
NSLog(#"Error : %#",error);
}];
}
Any help or suggestions will be appreciated !
Thanks !
Finally, I removed OAuth token and it works fine !
See code below :
STTwitterAPIWrapper *twitter = [STTwitterAPIWrapper twitterAPIApplicationOnlyWithConsumerKey:OAUTH_CONSUMER_KEY consumerSecret:OAUTH_CONSUMER_SECRET];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {
[twitter getSearchTweetsWithQuery:searchQuery successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
NSLog(#"Search data : %#",searchMetadata);
NSLog(#"\n\n Status : %#",statuses);
} errorBlock:^(NSError *error) {
NSLog(#"Error : %#",error);
}];
} errorBlock:^(NSError *error) {
NSLog(#"-- error %#", error);
}];
I am Nicolas Seriot the creator of STTwitter.
The issue you encountered was a bug and I just fixed it.
Try to add HTML encode the keywords. For example with
[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]

Resources