Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not exactly sure what you are trying to, but looking at your code I think you need to use a <a href="http://en.wikipedia.org/wiki/For_loop" rel="nofollow noreferrer">for</a> loop. </p> <p>Also the first line of your code is leaks. I'm not sure what you are trying to do. As far as I can see you don't have to create an empty dictionary here. </p> <p>The line where you retrieve your tweetValues (<code>tweetValues = [tweets objectAtIndex:1];</code>) is also strange. You are retrieving the object at index 1. Since arrays are <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSArray_Class/Reference/Reference.html#//apple_ref/doc/uid/20000137-279947" rel="nofollow noreferrer">zero-indexed</a> you are retrieving the second object in the array. If you wanted to retrieve the first you need to call: <code>[tweets objectAtIndex:0];</code></p> <p>If I had to refactor your code I would probably do something like: </p> <pre><code>[UIApplication sharedApplication].applicationIconBadgeNumber = 0; NSString *oldStatusID = [[NSUserDefaults standardUserDefaults] stringForKey:@"latestID"]; for (NSDictionary *tweetValues in tweets) { // Iterate over all the tweetValues in tweets (assume tweets exist?) NSString *newStatusID = [[tweetValues objectForKey:@"id"] stringValue]; if ([oldStatusID isEqualToString:newStatusID]) { [UIApplication sharedApplication].applicationIconBadgeNumber++; // Increase the badge number by 1 } } </code></pre> <p>I hope I correctly interpreted your code. If not, some more context might be useful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload