I have an OS X application which is analogous to OS X WiFi networks list status bar which we all use everyday.
It refreshes the list every few seconds and updates the new list in place. This works very well unless I use [NXOAuth2Request performMethod...] and mock the data source. However when I start using performMethod, the responseHandler: block is only invoked when I click somewhere and status menu closes.
I add the timer that invokes my selector (say, mySel) like this:
When I click the menu, I add the timer to run loop and then my selector gets invoked and prints Started API call however Handler! is only printed after menu is closed (e.g. by clicking somewhere else). It's even happening NSMenuDelegate's menuDidClose: is called.
It's never called as long as I keep the menu open. It just keeps invoking my selector and I get bunch of Started API call messages. But the moment it's closed all requests are executed (I see the network+server delay ~100 ms in API call between requests and Handler! is printed, so they're invoked serially when menu is closed.)
I don't know much about run loops and threading in Objective-C, so I tried to provide as much information as I can.
For now I'll start using AFNetworking and will directly use [[account accessToken] accessToken] but I'm not sure that will be refreshed automatically when expired etc and when the NXOAuth2Request refreshes the tokens normally etc. I really appreciate if you can help with this. Thanks!
I have an OS X application which is analogous to OS X WiFi networks list status bar which we all use everyday.
It refreshes the list every few seconds and updates the new list in place. This works very well unless I use
[NXOAuth2Request performMethod...]
and mock the data source. However when I start usingperformMethod
, theresponseHandler:
block is only invoked when I click somewhere and status menu closes.I add the timer that invokes my selector (say,
mySel
) like this:and then I have
When I click the menu, I add the timer to run loop and then my selector gets invoked and prints
Started API call
howeverHandler!
is only printed after menu is closed (e.g. by clicking somewhere else). It's even happeningNSMenuDelegate
'smenuDidClose:
is called.It's never called as long as I keep the menu open. It just keeps invoking my selector and I get bunch of
Started API call
messages. But the moment it's closed all requests are executed (I see the network+server delay ~100 ms in API call between requests andHandler!
is printed, so they're invoked serially when menu is closed.)I don't know much about run loops and threading in Objective-C, so I tried to provide as much information as I can.
For now I'll start using AFNetworking and will directly use
[[account accessToken] accessToken]
but I'm not sure that will be refreshed automatically when expired etc and when the NXOAuth2Request refreshes the tokens normally etc. I really appreciate if you can help with this. Thanks!