I am trying to get the sentDirectMessages of a twitter user via MGTwitterEngine. However, I am not receiving an MGTwitterEngine delegation method callback from the engine to say its received data.
I put an NSLog to see if the connectionFinished method was being called, and it was, but no other methods were i.e - (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier
Please could you tell me what the problem is, all delegates are set to self.
[manager.engine getSentDirectMessagesSinceID:0 startingAtPage:0];
Sry, but I will ask the routine question: Do you have MGTwitterEngineDelegate in your .h file?
I suggest throwing some logging in requestSucceeded:
and requestFailed:withError:
Are you successfully doing any other types of Twitter communication within that project? within the same class?
EDIT
I setup a DM request and it worked correctly with a requestSucceeded:
and a directMessagesReceived:forRequest:
Based on your:
"So everytime I want to get the dm's of the user, I will have to get the user to logout and then login again."
I am wondering if this is not an issue where the users token is not being stored correctly? I suggest look into how the successful login is storing the token?
In particular this MGTwitterEngineDelegate method.
- (void)accessTokenReceived:(OAToken *)aToken forRequest:(NSString *)connectionIdentifier
{
NSLog(@"Access token received! %@",aToken);
[manager.engine setAccessToken:aToken];
//I have an OAToken variable called "token" defined in my .h
token = [aToken retain];
NSLog(@"storing token in userdefaults");
//this line is key for maintaining a login token throughout the app
//even when the user closes the app and comes back
[token storeInUserDefaultsWithServiceProviderName:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"] prefix:@"twitter"];
//call your dm or whatever methods for after login here
.
.
.
}
Hope this helps.