As near as I can tell, NSURLConnection does not support NTLM authentication.

So, if you are considering implementing something using NSURLConnection: take a moment to make sure you will never talk to a server expecting you to authenticate via NTLM (which is IIS as near as I can tell) before you waste two evenings doing it.

That being said, NSURLConnection is really cool and I wish I could use it.

For my next trick, figure out how to do this with CFHTTPMessage, which does provide kCFHTTPAuthenticationSchemeNTLM for authentication.

*sigh*

regular, tech Comments Closed
Monday, July 28th, 2008

A few months ago, I spent a few days searching around to see if I could figure out how to determine the instance variables on a class in ObjC. I knew it was possible because Key-Value-Coding will do it if it can’t find the well-named accessor methods for a keypath. But all of my searching proved fruitless and I went with a different method of accomplishing my end goal.

Well, it looks like the answer has appeared in my feed reader on an entry from Matt Gallagher’s Cocoa With Love blog:Key Value Information.

I’ll just quote him (from the very end of his post):

Similarly, if you were interested in key value coding that may access instance variables directly, you could use class _getClassVariable to get any instance variables with the same name as the key.

The leading underscore on the method name indicates that it’s undocumented and internal to Apple’s implementation. So using it isn’t necessarily the smartest thing in the world. But sometimes, you’ve gotta do what you gotta do.

Now that I have a method name, I’ll probably resume my search for information on this technique and will obviously report any findings here.

Update: July 29, 2008

I did some poking around in the Objective-C 2.0 Runtime Reference and found the class_copyIvarList function which returns an array of Ivar types. Ivar is a struct containing fields for the ivar_name, ivar_type, and offset. Combined with object_getIvar, I think I would have been much closer to achieving my original goal.

I don’t know why I couldn’t find this before. I guess I was just looking in the wrong places.

regular, tech Comments Closed