Tuesday 15 March 2011

ios - Post an image along with a comment to wordpress blog -


Through my iOS app, I am showing the blog to friends I can post comments on the blog with the following code .

  NSString * postContent = @ "comment_post_ID =% @ & comment_parent =% @ & amp; comment =% @ & author =% @ & amp; submit =% @ & amp; Email =% @ "; NSString * PostString = [NSString stringWithFormat: postContent, @ "22168", @ "0", self.commentText.text, self.commentName.text, @ "Post + Comment", @ "email@something.com"]; NSString * Post = PostString; NSDTA * PostData = [Post Data Usage Encoding: NSSEIITITING Encoding Permission Loansy Conversion: Yes]; NSMutableURLRequest * Request = [[NSMutableURLRequest alloc] init]; NSString * postLength = [NSString stringWithFormat: @ "% d", [PostData Length]]; NSString * URLString = @ "fakeaddress.com/wp-comments-post.php"; NSURL * postURL = [NSURL URLWithString: URLString]; [Request URL: post URL]; [Set http system: @ "post"]; [Set set property: post length for http header field: @ "content-length"]; [Request Set Value: @ "App / X-www-Form-URLXode" forHTTPHeaderField: @ "Content-Type"]; [Set http: bb: postdata]; Self.postConnection = [Request with NSR connection connection: Request Rep: Self];   

Postconditionation is created elsewhere.

The post comes great, but there is also a place for the user picture. So if the user is a member, then their picture increases with the comment. I want to see if I can make a picture of my app's icon, so my friend knows that the comment was posted with the app. Instead of just the default headshot framework, I wanted to stay away from Gravatar Do anyone have any advice? thank you in advanced.

You should use a Gravatar image (associated with your email address), unless they are extended Do not allow comment form to allow a photo (upload or url) to post.

If they expand the comment form, then this is just plain HTTP to submit the URL parameter. To upload an attachment, see this question:

No comments:

Post a Comment