On Fri, Jul 23, 2010 at 9:34 AM, Joe Turner <joetur...@me.com> wrote: > Hey, > > No one is requiring me to send a string–I do indeed send it as data, but I > must convert values from string to data. Like, I have a title field, in which > I must convert the title to NSData. But since there are a bunch of arguments > like this, I just make a string like @"arg1=something&arg2=something...", and > then do [dataUsingEncoding:allowLossyConversion:. > > Should I be doing this a better way? (I'm the one who created the web > service, so if there's an issue with doing it this way, I can easily change > it).
Yes. The better way is not to use NSString, since strings are a conceptually different beast from data. You might start out with a string (say, the user types something into a text field), but you want to convert that to data at some point before tacking it on to the rest of the data that comprises your POST request. Don't conflate the two, which you're doing by trying to build a string that contains your urlencoded POST data. Convert the strings to data *first*, then compile all your data into a POST request. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com