NSDictionaries are not sorted. allKeys returns keys in a random order. There is no guarantee whatsoever that it will return the same order twice, so this approach is inherently flawed. And this line:
long time = (long)[[tempPosts allKeys] objectAtIndex:section];
is absolutely completely wrong. You are picking one of the keys of the dictionary, which is a pointer to an object, most like an NSString*. You cast this to long - but casting an address of an NSObject to long just gives you meaningless bits.
I suggest you describe what you actually want.
And NSDictionary is entirely unsuitable for your data model, as you may have figured out by now. Take that dictionary and convert it into an object containing what your application needs.