Warum ändert RestKit meinen Antwortinhaltstyp?

Kurzum: Ich versuche, Daten vom Server mit dem abzurufencontent-type des HTTP-Request-Headers gesetzt als@"text/html.. aber aus irgendeinem Grund ändert RestKit das zuapplication/JSON

Erläuterung: Wenn ich diese Anfrage mit nur machen würdeAFNetworking.. Dinge funktionieren wie ein Zauber .. so sieht mein AFNetworking-Code aus:

AFHTTPClient *client = [AFHTTPClient alloc] initWithBaseURL:
                                               [NSURL URLWithString:kApiBaseUrl]];
singleton.parameterEncoding = AFJSONParameterEncoding;
[singleton setDefaultHeader:@"Accept" value:@"text/html"];
[client getPath:getPath parameters:nil success:successCallback failure:failureCallback];

Wenn ich das benutzegenau derselbe Client und befestigen Sie es an

MyClient *client = [MyClient getSingleton];  //MyClient is instantiated as above        
self.objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
self.objectManager.managedObjectStore = self.managedObjectStore;
// this should have already been done by my client, but putting
// it here just to be sure
[self.objectManager setAcceptHeaderWithMIMEType:@"text/html"];

[[RKObjectManager sharedManager] getObjectsAtPath:kGradesPath 
                                       parameters:nil 
                                          success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
 // handle success
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
 // handle failure
}];

Der Fehler, den ich bekomme, ist:

 restkit.network:RKObjectRequestOperation.m:576 Object request failed: 
 Underlying HTTP request operation failed with error: Error
 Domain=org.restkit.RestKit.ErrorDomain Code=-1016 "Expected content type {(
    "application/x-www-form-urlencoded",
    "application/json"
)}, got text/html" UserInfo=0x8f7acd0

Ich grabe mich in das Thema einmanagedObjectRequestOperationWithRequest, dann habe ich das überprüftacceptContentTypes vonHTTPRequestOperation erstellt, und es ist null! Ich gehe also davon aus, dass RestKit nur seine eigenen akzeptablen Standardinhaltstypen verwendet. Ich weiß nur nicht, wo und wie ich das verhindern soll. Ideen?

p.s. Ich habe keine Kontrolle über den Server, kann ihn also nicht änderncontent-type Header zuapplication/JSON

Aktualisieren:

Es stellt sich heraus, dass inRKObjectRequestOperation.m es bekommt diemime-type von[RKMIMETypeSerialization registeredMIMETypes];(Zeile 354) .. und so weiterRKMIMETypeSerialization.hes gibt die methode:

/**
 Registers the given serialization class to handle content for the given MIME Type identifier.

 MIME Types may be given as either a string or as a regular expression that matches the MIME Types for which the given serialization should handle. Serializations are searched in the reverse order of their registration. If a registration is made for an already registered MIME Type, the new registration will take precedence.

 @param serializationClass The class conforming to the RKSerialization protocol to be registered as handling the given MIME Type.
 @param MIMETypeStringOrRegularExpression A string or regular expression specifying the MIME Type(s) that given serialization implementation is to be registered as handling.
 */
+ (void)registerClass:(Class<RKSerialization>)serializationClass forMIMEType:(id)MIMETypeStringOrRegularExpression;

Wie benutze ich dies, um einetext/html Inhaltstyp?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage