How can I see the communication of the RestKit network (JSON string)? - restkit

I wish to see the JSON input/output of the iPhone. How can I do that?
Do I need to set use NSLog() (and where)? Or, set the RestKit logging level (to what)?

Try placing this RKLogConfigureByName("RestKit/Network", RKLogLevelTrace); in your AppDelegate

You can use Charles - Debugging Proxy

Related

Set Away/Home Mode

Does the API expose the ability to set the mode to Away or Home?
I don’t see this listed in the API documentation. I think this functionality is important as it now only allows you to turn off your thermostats but also configure alerts via the mobile app (I have mine set to only send alerts for my NestCams when I’m away).
You can't set "away", but you can set the thermostat to either Eco or Off.
No. I also hope the old functionality of the Nest API's will be available on the new API. The motion/person per zone is also missing for example.
There's no way to explicitly set that in this new API. Google wants you to use their Home/Away Routines instead, though I don't think all of the old use cases are supported yet (or will be).
https://support.google.com/googlenest/answer/10071816

Remote Notification removing in watchOS

I wonder is it possible to remove a notification from an Apple Watch that was sent by my application?
I really need it.
Thanks in advance.
It is possible, you just have to call one of the following two methods of UNUserNotificationCenter: removePendingNotificationRequests(withIdentifiers:) or removeAllPendingNotificationRequests()
Reference

How to view the raw XML or Json response using LinqToTwitter?

How can I view the raw XML or Json response when doing a search for users using the LinqToTwitter library? I'm using the SingleUserAuthorizer for oAuth.
If you have any ideas using other libraries or even a simple oAuth framework, I'm open to suggestions.
Thanks.
TwitterContext has a RawResults property you can use.
If this is just for debugging purposes, I'd use Wireshark or Fiddler - that way you get to see the complete HTTP requests/responses.

How to obtain firefox user agent string?

I'm building an add-on for FireFox that simulates a website, but running from a local library. (If you want to know more, look here)
I'm looking for a way to get a hold of the user-agent string that FireFox would send if it were doing plain http. I'm doing the nsIProtocolHandler myself and serve my own implementation of nsIHttpChannel, so if I have a peek at the source, it looks like I'll have to do all the work myself.
Unless there's a contract/object-id on nsHttpHandler I could use to create an instance just for a brief moment to get the UserAgent? (Though I notice I'll need to call Init() because it does InitUserAgentComponents() and hope it'll get to there... And I guess the http protocol handler does the channels and handlers so there won't be a contract to nsHttpHandler directly.)
If I have a little peek over the wall I notice this globally available call ObtainUserAgentString which does just this in that parallel dimension...
Apparently Firefox changed how this was done in version 4. Have you tried:
alert(window.navigator.userAgent);
You can get it via XPCOM like this:
var httpHandler = Cc["#mozilla.org/network/protocol;1?name=http"].
getService(Ci.nsIHttpProtocolHandler);
var userAgent = httpHandler.userAgent;
If for some reason you actaully do need to use NPAPI like you suggest in your tags, you can use NPN_UserAgent to get it; however, I would be shocked if you actually needed to do that just for an extension. Most likely Anthony's answer is more what you're looking for.

Download file with progress bar in cocoa?

I need to have a progress bar that responds to the percent complete of a download in cocoa. I think this might use things like NSProgressindicator and possibly NSTask. I'm not sure if theres an "official" method to download file in cocoa because up until now I just used curl with NSTask. Thanks for any replies.
Use NSURLConnection. It has a delegate property, which means it will tell you periodically that it has received more data (which you then have to save to a file yourself). However, it also tells you when it has started retrieving the file, and if you're downloading a file over HTTP (which I think is a safe assumption), it will most likely have a Content-Length: HTTP header, so you can know what to set as the maxValue of your NSProgressIndicator. Then just incrementBy: the size of the data your connection has told you it just received.
If for some reason you get a chunked HTTP transfer, then just set the progress bar to be indeterminate, since that's the whole point of a chunked transfer (that you don't know how big it's going to be).
I'm not sure if theres an "official" method to download file in cocoa …
There is: NSURLDownload.

Resources