Skip to content

Commit 4d1ce1b

Browse files
committed
Update tweetstream example
1 parent 641f506 commit 4d1ce1b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Examples/TweetStream/TweetStream/TweetStreamViewController.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ - (IBAction)go {
8080
// from the adapter.
8181
adapter.delegate = self;
8282

83+
// Normally it's an error if JSON is followed by anything but
84+
// whitespace. Setting this means that the parser will be
85+
// expecting the stream to contain multiple whitespace-separated
86+
// JSON documents.
87+
adapter.supportManyDocuments = YES;
88+
8389
// Create a new stream parser..
8490
parser = [[SBJsonStreamParser alloc] init];
8591

8692
// .. and set our adapter as its delegate.
8793
parser.delegate = adapter;
8894

89-
// Normally it's an error if JSON is followed by anything but
90-
// whitespace. Setting this means that the parser will be
91-
// expecting the stream to contain multiple whitespace-separated
92-
// JSON documents.
93-
parser.supportMultipleDocuments = YES;
94-
9595
NSURL *url = [NSURL URLWithString: @"https://stream.twitter.com/1.1/statuses/sample.json"];
9696
SLRequest *request = [SLRequest requestForServiceType: SLServiceTypeTwitter
9797
requestMethod: SLRequestMethodGET
@@ -105,11 +105,7 @@ - (IBAction)go {
105105

106106
#pragma mark SBJsonStreamParserAdapterDelegate methods
107107

108-
- (void)parser:(SBJsonStreamParser *)parser foundArray:(NSArray *)array {
109-
[NSException raise:@"unexpected" format:@"Should not get here"];
110-
}
111-
112-
- (void)parser:(SBJsonStreamParser *)parser foundObject:(NSDictionary *)dict {
108+
- (void)parser:(SBJsonStreamParser *)parser found:(id)dict {
113109

114110
if ([dict[@"id"] longLongValue] != [dict[@"id_str"] longLongValue]) {
115111

0 commit comments

Comments
 (0)