[twitter-dev] Re: [Twitter Profile Image Update]What am I gonna do? anybody knows?

2010-06-17 Thread jusung Kye
thank you Taylor for sharing your time for me ;)


On 6월16일, 오후10시56분, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Hi Jusung,

 Our image upload facilities are in need of some refactoring -- they
 frequently respond with a 500, sometimes having processed the image and
 sometimes not. Have you checked after uploading to see if the image was
 accepted?

 I'm not familiar enough with Objective-C to really help you in that area,
 but I wanted to make sure you know that basic authentication is going away
 later this month, and if you're working on any kind of new project, you
 should be using OAuth:http://dev.twitter.com/pages/auth_overview

 Taylor



 On Tue, Jun 15, 2010 at 11:43 PM, jusung Kye kyejus...@gmail.com wrote:
  I'm trying to make a APP about changing Twitter Avatar Image.
  I have tried about this problem for 2week. but I could found any
  solution.

  I tried this method using Curl. and this method works well.

  [Curl Method]
  curl -u user:password -H 'Expect:' -F image=@'test2.png;type=image/
  png'http://api.twitter.com/1/account/update_profile_image.xml

  but iPhone is not working.

  Did I forgot or missed something?
  Anybody~ Somebody~ help me.

  My codes is like below and The debbuger show like this error messages

  -(void)request:(NSURL *)url{
         if (isPost) {

                 UIImage *myImage = [UIImage imageNamed:@1.jpg];
                 NSData *imageData = [[NSData alloc]
  initWithData:UIImageJPEGRepresentation(myImage, 90)];
                 requestBody = [NSString stringWithFormat:@
  image=%@,[[[NSString
  alloc] initWithData:imageData
  encoding:NSUTF8StringEncoding]autorelease]];

                 theRequest = [[NSMutableURLRequest alloc] initWithURL:url];
                 [theRequest setHTTPMethod:@POST];
                 NSString *stringBoundary = [NSString
  stringWithString:@0xKhTmLbOuNdArY];
                 NSString *contentType = [NSString stringWithFormat:@
  multipart/form-
  data; boundary=%@, stringBoundary];
                 [theRequest addValue:contentType forHTTPHeaderField:@
  Content-
  Type];

                 NSMutableData *postBody = [NSMutableData data];
                 [postBody appendData:[[NSString stringWithFormat:@
  \r\n\r\n...@\r
  \n, stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
                 [postBody appendData:[[NSString stringWithString:@Content-
  Disposition: form-data; name=\source\\r\n\r\n]
  dataUsingEncoding:NSUTF8StringEncoding]];
                 [postBody appendData:[[NSString stringWithString:@canary]
  dataUsingEncoding:NSUTF8StringEncoding]];

                 NSString *mimeType = mimeType = @image/jpeg;

                 [postBody appendData:[[NSString stringWithFormat:@\r\n--%@
  \r
  \n,stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
                 [postBody appendData:[[NSString stringWithFormat:@Content-
  Disposition: form-data; name=\image\; filename=\%...@\\r\n,
  @1.jpg] dataUsingEncoding:NSUTF8StringEncoding]];
                 [postBody appendData:[[NSString 
  stringWithFormat:@Content-Type:
  %...@\r
  \n, mimeType] dataUsingEncoding:NSUTF8StringEncoding]];
                 [postBody appendData:[[NSString stringWithString:@
  Content-Transfer-
  Encoding: binary\r\n\r\n] dataUsingEncoding:NSUTF8StringEncoding]];
                 //[postBody appendData:image];
                 [postBody appendData:imageData];
                 [postBody appendData:[[NSString stringWithFormat:@\r\n--%@
  \r
  \n,stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];

                 [theRequest setHTTPBody:postBody];

                 NSLog(@ispost);
         theConnection = [[NSURLConnection alloc] initWithRequest:theRequest
  delegate:self];

         }

         if (theConnection) {
                 // Create the NSMutableData that will hold
                 // the received data
                 // reveivedData is declared as a method instance elsewhere
                 receivedData = [[NSMutableData data] retain];
         }else {
                 // inform the user that the download could not be made
         }
  }

  [Error Messages]

  Attaching to process 45645.
  2010-06-16 13:57:51.025 tw[45645:207] ispost
  2010-06-16 13:57:52.193 tw[45645:207] Status: 500 Internal Server
  Error
  Content-Type: text/html

  htmlbodyh1500 Internal Server Error/h1/body/htmlStatus:
  500 Internal Server Error
  Content-Type: text/html

  htmlbodyh1500 Internal Server Error/h1/body/html
  (gdb) clear


[twitter-dev] Re: [Twitter Profile Image Update]What am I gonna do? anybody knows?

2010-06-17 Thread jusung Kye
nope! I have got the 500 errors and also couldn't changed the avatar
image.

On 6월17일, 오전12시18분, Clint Shryock cl...@ctshryock.com wrote:
 Jusung -

 I'm using Objective-c as well and I've gotten more than an handful of 500
 errors, even the the post was successful and the avatar was updated.
 The users/show API also is slow to update and show the new avatar.

 Is your Twitter avatar update reflected on twitter.com ?

 +Clint

 On Wed, Jun 16, 2010 at 8:56 AM, Taylor Singletary 



 taylorsinglet...@twitter.com wrote:
  Hi Jusung,

  Our image upload facilities are in need of some refactoring -- they
  frequently respond with a 500, sometimes having processed the image and
  sometimes not. Have you checked after uploading to see if the image was
  accepted?

  I'm not familiar enough with Objective-C to really help you in that area,
  but I wanted to make sure you know that basic authentication is going away
  later this month, and if you're working on any kind of new project, you
  should be using OAuth:http://dev.twitter.com/pages/auth_overview

  Taylor

  On Tue, Jun 15, 2010 at 11:43 PM, jusung Kye kyejus...@gmail.com wrote:

  I'm trying to make a APP about changing Twitter Avatar Image.
  I have tried about this problem for 2week. but I could found any
  solution.

  I tried this method using Curl. and this method works well.

  [Curl Method]
  curl -u user:password -H 'Expect:' -F image=@'test2.png;type=image/
  png'http://api.twitter.com/1/account/update_profile_image.xml

  but iPhone is not working.

  Did I forgot or missed something?
  Anybody~ Somebody~ help me.

  My codes is like below and The debbuger show like this error messages

  -(void)request:(NSURL *)url{
 if (isPost) {

 UIImage *myImage = [UIImage imageNamed:@1.jpg];
 NSData *imageData = [[NSData alloc]
  initWithData:UIImageJPEGRepresentation(myImage, 90)];
 requestBody = [NSString stringWithFormat:@
  image=%@,[[[NSString
  alloc] initWithData:imageData
  encoding:NSUTF8StringEncoding]autorelease]];

 theRequest = [[NSMutableURLRequest alloc] initWithURL:url];
 [theRequest setHTTPMethod:@POST];
 NSString *stringBoundary = [NSString
  stringWithString:@0xKhTmLbOuNdArY];
 NSString *contentType = [NSString stringWithFormat:@
  multipart/form-
  data; boundary=%@, stringBoundary];
 [theRequest addValue:contentType forHTTPHeaderField:@
  Content-
  Type];

 NSMutableData *postBody = [NSMutableData data];
 [postBody appendData:[[NSString stringWithFormat:@
  \r\n\r\n...@\r
  \n, stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
 [postBody appendData:[[NSString stringWithString:@
  Content-
  Disposition: form-data; name=\source\\r\n\r\n]
  dataUsingEncoding:NSUTF8StringEncoding]];
 [postBody appendData:[[NSString stringWithString:@
  canary]
  dataUsingEncoding:NSUTF8StringEncoding]];

 NSString *mimeType = mimeType = @image/jpeg;

 [postBody appendData:[[NSString stringWithFormat:@
  \r\n...@\r
  \n,stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
 [postBody appendData:[[NSString stringWithFormat:@
  Content-
  Disposition: form-data; name=\image\; filename=\%...@\\r\n,
  @1.jpg] dataUsingEncoding:NSUTF8StringEncoding]];
 [postBody appendData:[[NSString 
  stringWithFormat:@Content-Type:
  %...@\r
  \n, mimeType] dataUsingEncoding:NSUTF8StringEncoding]];
 [postBody appendData:[[NSString stringWithString:@
  Content-Transfer-
  Encoding: binary\r\n\r\n] dataUsingEncoding:NSUTF8StringEncoding]];
 //[postBody appendData:image];
 [postBody appendData:imageData];
 [postBody appendData:[[NSString stringWithFormat:@
  \r\n...@\r
  \n,stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];

 [theRequest setHTTPBody:postBody];

 NSLog(@ispost);
 theConnection = [[NSURLConnection alloc] initWithRequest:theRequest
  delegate:self];

 }

 if (theConnection) {
 // Create the NSMutableData that will hold
 // the received data
 // reveivedData is declared as a method instance elsewhere
 receivedData = [[NSMutableData data] retain];
 }else {
 // inform the user that the download could not be made
 }
  }

  [Error Messages]

  Attaching to process 45645.
  2010-06-16 13:57:51.025 tw[45645:207] ispost
  2010-06-16 13:57:52.193 tw[45645:207] Status: 500 Internal Server
  Error
  Content-Type: text/html

  htmlbodyh1500 Internal Server Error/h1/body/htmlStatus:
  500 Internal Server Error
  Content-Type: text/html

  htmlbodyh1500 Internal Server Error/h1/body/html
  (gdb) clear