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.
Related
I want to share a post on Pintrest( i.e. want to pin from my app). I have used its SDK using Cocoa Pod. I'm able to pin (share) sometimes but sometimes while pinning it app crashes on random basis and getting nothing in crash log.
Can anyone tell me what is going wrong ? I'm adding the code snippet that i have used...I have used this link to install the SDK and followed this link. https://github.com/pinterest/ios-pdk
-(IBAction)pintrestButtonTapped
{
#try
{
[PDKClient configureSharedInstanceWithAppId:#"4841203782190640720"];
[[PDKClient sharedInstance] authenticateWithPermissions:#[PDKClientReadPublicPermissions,
PDKClientWritePublicPermissions,
PDKClientReadPrivatePermissions,
PDKClientWritePrivatePermissions,
PDKClientReadRelationshipsPermissions,
PDKClientWriteRelationshipsPermissions]
withSuccess:^(PDKResponseObject *responseObject)
{
[PDKPin pinWithImageURL:[NSURL URLWithString:#"https://www.respectnetwork.com/wp-content/uploads/cynja-app_store_share.jpg"]
link:[NSURL URLWithString:#"https://itunes.apple.com/us/app/cynjaspace/id1050628761?ls=1&mt=8/"]
suggestedBoardName:#"CynzaSpace"
note:kSocialMediaSharingText
withSuccess:^
{
NSLog(#"Successfully Pinned Up!!");
}
andFailure:^(NSError *error)
{
NSLog(#"UnSuccessfull");
}];
}
andFailure:^(NSError *error)
{
NSLog(#"authentication failed: %#", error);
}];
}
#catch (NSException *exception)
{
// Print exception information
NSLog( #"NSException caught" );
NSLog( #"Name: %#", exception.name);
NSLog( #"Reason: %#", exception.reason );
return;
}
}
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.
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.
:-)
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]
Everyone once in a while I will get crash reports for my App (via crittercism) with the following NSInvalidArgumentException crash:
+[GKAchievement reportAchievements:withCompletionHandler:]: unrecognized selector sent to class 0x3f940a84
The code looks like this:
NSMutableArray *achivementArray = [NSMutableArray arrayWithCapacity:20];
for (NSString *achievementID in achievementsToUpload) // achievementsToUpload is a NSSet
{
GKAchievement *achievement = [[GKAchievement alloc] initWithIdentifier:achievementID];
if (achievement)
{
...
[achivementArray addObject:achievement];
}
}
[GKAchievement reportAchievements:achivementArray withCompletionHandler:^(NSError *error)
{
if (error != nil)
{
NSLog(#"Error sending achievement: %#", error.localizedDescription);
}
}];
If the error is indeed inside reportAchievements:withCompletionHandler:, as far as I can see, the source of the error can come from two places: 1) achivementArray is not an NSArray or 2) error is not really an NSError.
In the case of #1, I create the array a few lines above the call and in case #2, I doubt the OS is sending back a non-NSError object.
Any ideas?
Header looks like:
+ (void)reportAchievements:(NSArray *)achievements withCompletionHandler:(void(^)(NSError *error))completionHandler __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0);
So the issue may be in base sdk that you are using. This method is available starting from iOS 6.0.
Hope it will be helpful