我正在尝试使用Restkit在iOS应用程序中调用其他Web服务,但是我收到此错误: restkit.network:RKObjectRequestOperation.m:210 response.body = 415不支持的媒体类型
$this->request->session()->write($name, $value);
$this->request->session()->read($name);
这是我在控制台中显示的请求
objectManager.requestSerializationMIMEType = RKMIMETypeJSON;
然后我发现问题可能是由{charset = utf-8引起的here引起的。 我的问题是如何删除Restkit中的“charset = utf-8”
答案 0 :(得分:0)
感谢@Wain评论,我通过创建请求并设置内容类型标题来解决问题:
Private Sub Chart1_PostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataVisualization.Charting.ChartPaintEventArgs) Handles Chart1.PostPaint
If TypeOf e.ChartElement Is Legend Then
Dim c As Chart = CType(sender, Chart)
Dim g As Graphics = e.ChartGraphics.Graphics
'The legend
Dim l As Legend = c.Legends(0)
'Absolute dimensions of the legend (New legend will be based on this.. won't be exact.)
Dim pos As RectangleF = e.ChartGraphics.GetAbsoluteRectangle(l.Position.ToRectangleF)
'Absolute dimensions of one legend "cell"
Dim itemHeight As Single = pos.Height / c.Series.Count
Dim itemWidth As Single = pos.Width / 2
'Padding between line and text (horizontal) and each item (vertical)
Dim horizontalPadding As Single = 10
Dim verticalPadding As Single = 1
Dim legendFont As New Font("Arial", 10)
'Draw a white box on top of the default legend to hide it
g.FillRectangle(Brushes.White, pos)
For i As Integer = 0 To c.Series.Count - 1
Dim s As Series = c.Series(i)
Dim p As New Pen(s.Color, CSng(Math.Min(s.BorderWidth, itemHeight))) 'Line no thicker than the item height.
'Line
Dim posY As Single = CSng(pos.Y + (verticalPadding * i + itemHeight * i + itemHeight / 2))
Dim startPoint As PointF = New PointF(pos.X, posY)
Dim endPoint As PointF = New PointF(CSng(pos.X + itemWidth), posY)
g.DrawLine(p, startPoint, endPoint)
'Text
posY = CSng(pos.Y + verticalPadding * i + itemHeight * i)
startPoint = New PointF(CSng(pos.X + itemWidth), posY)
g.DrawString(s.Name, legendFont, Brushes.Black, startPoint.X + horizontalPadding, startPoint.Y)
Next
End If
End Sub
答案 1 :(得分:0)
我希望这有助于某人。这最近发生在我身上,我也缺少Content-Type。但是,您可以轻松地将其添加到RKObjectManager:
RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:YOUR_BASE_URL]];
[manager setRequestSerializationMIMEType:RKMIMETypeJSON];