Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>-(void)postMessageWithPictureOnFB{ NSString *urlString = [[NSString alloc] initWithFormat:@"https://graph.facebook.com/me/photos"]; NSURL *url = [[NSURL alloc] initWithString:urlString]; NSData *picture_data = UIImagePNGRepresentation([UIImage imageNamed:@"apple.png"]); NSMutableData *body = [[NSMutableData alloc] initWithCapacity:1]; NSString *boundary = [[NSString alloc] initWithString:@"----1010101010"]; NSString *contentType = [[NSString alloc] initWithFormat:@"multipart/form-data; boundary=%@",boundary]; [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"message\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[textView.text dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"media\";\r\nfilename=\"media.png\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:picture_data]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"access_token\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[facebook.accessToken dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; serverRequest = [ASIHTTPRequest requestWithURL:url]; [serverRequest addRequestHeader:@"Content-Type" value:contentType]; [serverRequest appendPostData:body]; [serverRequest addRequestHeader:@"Content-Length" value:[NSString stringWithFormat:@"%d", body.length]]; //[serverRequest setDelegate:self]; //[serverRequest setDidFinishSelector:@selector(postMessageWithPictureOnFBRequestDone:)]; //[serverRequest setDidFailSelector:@selector(postMessageWithPictureOnFBRequestWentWrong:)]; [serverRequest startAsynchronous]; [urlString release]; [url release]; [body release]; [boundary release]; [contentType release]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload