STTwitter CFNetwork internal error NSURLRequest
Asked Answered
M

1

5

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?

Mixon answered 14/6, 2014 at 19:32 Comment(3)
I don't know for sure, but there may be something wrong in STHTTPRequest.Preshrunk
Your exactly right, the exception is being thrown by [request setHTTPMethod:_HTTPMethod] (line 357, requestByAddingCredentialsToURL:) Going to do some more digging to see if I can find the issue.Mixon
After some more investigation and a bit of looking into the Apple documentation, it looks like [setHTTPMethod] is obsolete in iOS 8 (I am using the beta). I ran the same code on an older device using iOS 7.1 and the error did not come up. However, neither did a tableview of twitter feed entries. Going to keep looking.Mixon
P
5

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.

Preshrunk answered 26/6, 2014 at 9:21 Comment(2)
Quick link to the commit in question (for STHTTPRequest, which worked well for me): github.com/nst/STHTTPRequest/commit/…Voiced
sorry took me awhile to get back to this, work caught up to me and my side projects got put on hold. Thanks so much for the update!Mixon

© 2022 - 2024 — McMap. All rights reserved.