原帖已删除
Ta的回复 : NSImage* i= [NSImage imageNamed:@"test.png"]; [i lockFocus]; NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, i.size.width, i.size.height)]; [i unlockFocus]; NSDictionary* p = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:2.0], NSImageCompressionFactor, nil]; NSData * imageData = [bitmapRep representationUsingType:NSPNGFileType properties:p]; NSString *base64String = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; NSString *requestKey = @"image="; requestKey = [requestKey stringByAppendingString:[base64String stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]; NSData *requestBody = [NSData dataWithBytes: [requestKey UTF8String] length: [requestKey length]]; NSString* requestString = [NSString stringWithFormat:@"%@?access_token=%@",GENERAL_BASIC,self.access_token]; NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestString]]; NSDictionary* HTTPHeader = @{@"Content-Type":@"application/x-www-form-urlencoded"}; request.HTTPBody = requestBody; request.allHTTPHeaderFields = HTTPHeader; request.HTTPMethod = @"POST"; NSURLResponse* response = nil; 你能不能 帮我看一下 啊? 还是有问题啊??