iOS - 使用 RestKit 进行 POST:未调用回调函数 - (使用映射数据)

发布于 2024-12-13 01:30:19 字数 11592 浏览 0 评论 0原文

大家好,这是我在 stack-overflow 上的第一篇文章,

首先,非常感谢所有分享的人!

我的问题是:

  • 当我使用 RKObjectManager 作为 POST 序列化对象时,我没有回调返回。
  • 而且我不知道我对映射数据的使用是否正确...

所以我向您展示了我的 Restful 服务的结果(以 JSON 格式)、我的代码和我的 Restkit 日志

{"sessionId":"DA93D5ECD8E338AA27800794EEB9C20F","user":{"id":3,"ref":"2461498766","login":"clientTest","mail":"[email protected]","phone":"client127","subId":3,"creation":"29/03/2010 10:33:24","language":"en","firstConnection":"30/03/2010 16:42:07","lastConnection":"02/11/2011 09:36:43","connectionStep":"6"},"gateway":{"id":3,"serial":"testserial","status":"A","led":"START","ref":"DJJHGGGG00009","type":"FULL","ip":"192.168.44.168","connection":"","initDate":1290694795533,"activationDate":1290694795533,"manufacDate":1269851384000,"imei":"354482020013035","model":"TYLOP","firmware":"1.3.1","version":"","macWifi":"...","macEthernet":"...","updateDate":1310053274000,"muteMode":"","timezone":""}}

如您所见,我们有一个全局对象里面:用户,网关对象。

VOAuth.h,我用于数据映射的全局对象:

#import "VOUser.h"
#import "VOGateway.h"

@interface VOAuth : NSObject
@property (nonatomic, retain) NSString * sessionId;
@property (nonatomic, retain) VOUser * user;
@property (nonatomic, retain) VOGateway * gateway;
@end

VOGateway.h,

#import <Foundation/Foundation.h>

@interface VOGateway : NSObject

@property (nonatomic, retain) NSString * identifier;
@property (nonatomic, retain) NSString * serial;
@property (nonatomic, retain) NSString * status;
@property (nonatomic, retain) NSString * led;
@property (nonatomic, retain) NSString * ref;
@property (nonatomic, retain) NSString * type;
@property (nonatomic, retain) NSString * ip;
@property (nonatomic, retain) NSString * connection;
@property (nonatomic, retain) NSString * initDate;
@property (nonatomic, retain) NSString * activationDate;
@property (nonatomic, retain) NSString * manufacDate;
@property (nonatomic, retain) NSString * imei;
@property (nonatomic, retain) NSString * model;
@property (nonatomic, retain) NSString * firmware;
@property (nonatomic, retain) NSString * version;
@property (nonatomic, retain) NSString * macWifi;
@property (nonatomic, retain) NSString * macEthernet;
@property (nonatomic, retain) NSString * updateDate;
@property (nonatomic, retain) NSString * muteMode;
@property (nonatomic, retain) NSString * timezone;

@end

VOUser.h,

#import <Foundation/Foundation.h>

@interface VOUser : NSObject

@property (nonatomic, retain) NSString * identifier;
@property (nonatomic, retain) NSString * ref;
@property (nonatomic, retain) NSString * login;
@property (nonatomic, retain) NSString * mail;
@property (nonatomic, retain) NSString * phone;
@property (nonatomic, retain) NSString * subId;
@property (nonatomic, retain) NSString * creation;
@property (nonatomic, retain) NSString * language;
@property (nonatomic, retain) NSString * firstConnection;
@property (nonatomic, retain) NSString * lastConnection;
@property (nonatomic, retain) NSString * connectionStep;

@end

SOAuth.h(我的序列化对象用作我的调用参数),

#import <Foundation/Foundation.h>

@interface SOAuth : NSObject
@property (nonatomic, retain) NSString* login;
@property (nonatomic, retain) NSString* password;
@end

MAModule.h(我的经理,我在这里调用我的restfull服务),

#import <Foundation/Foundation.h>
#import <RestKit/RestKit.h>
#import "VOUser.h"
#import "VOGateway.h"
#import "VOAuth.h"
#import "SOAuth.h"
@interface MAModule : NSObject <RKObjectLoaderDelegate>
-(void)sendLogIn;
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects;
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error;
@end

MAModule.m,

#import "MAModule.h"

@implementation MAModule

-(void)sendLogIn
{

RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);

RKObjectManager* manager = [RKObjectManager    objectManagerWithBaseURL:@"http://mydomain.dev/ui/v1"];
[RKObjectManager sharedManager].serializationMIMEType = RKMIMETypeJSON;
[manager.router routeClass:[SOAuth class] toResourcePath:@"/auth" forMethod:RKRequestMethodPOST];

RKObjectMapping* authSerializationMapping = [RKObjectMapping mappingForClass:[NSMutableDictionary class] ];
[authSerializationMapping mapAttributes:@"login", @"password", nil];
[[RKObjectManager sharedManager].mappingProvider setSerializationMapping:authSerializationMapping forClass:[SOAuth class] ];

RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[VOUser class]];
[userMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[userMapping mapKeyPath:@"ref" toAttribute:@"ref"];
[userMapping mapKeyPath:@"login" toAttribute:@"login"];
[userMapping mapKeyPath:@"mail" toAttribute:@"mail"];
[userMapping mapKeyPath:@"phone" toAttribute:@"phone"];
[userMapping mapKeyPath:@"subId" toAttribute:@"subId"];
[userMapping mapKeyPath:@"creation" toAttribute:@"creation"];
[userMapping mapKeyPath:@"language" toAttribute:@"language"];
[userMapping mapKeyPath:@"firstConnection" toAttribute:@"firstConnection"];
[userMapping mapKeyPath:@"lastConnection" toAttribute:@"lastConnection"];
[userMapping mapKeyPath:@"connectionStep" toAttribute:@"connectionStep"];


RKObjectMapping *gatewayMapping = [RKObjectMapping mappingForClass:[VOGateway class]];
[gatewayMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[gatewayMapping mapKeyPath:@"serial" toAttribute:@"serial"];
[gatewayMapping mapKeyPath:@"status" toAttribute:@"status"];
[gatewayMapping mapKeyPath:@"led" toAttribute:@"led"];
[gatewayMapping mapKeyPath:@"ref" toAttribute:@"ref"];
[gatewayMapping mapKeyPath:@"type" toAttribute:@"type"];
[gatewayMapping mapKeyPath:@"ip" toAttribute:@"ip"];
[gatewayMapping mapKeyPath:@"connection" toAttribute:@"connection"];
[gatewayMapping mapKeyPath:@"initDate" toAttribute:@"initDate"];
[gatewayMapping mapKeyPath:@"activationDate" toAttribute:@"activationDate"];
[gatewayMapping mapKeyPath:@"manufacDate" toAttribute:@"manufacDate"];
[gatewayMapping mapKeyPath:@"imei" toAttribute:@"imei"];
[gatewayMapping mapKeyPath:@"model" toAttribute:@"model"];
[gatewayMapping mapKeyPath:@"firmware" toAttribute:@"firmware"];
[gatewayMapping mapKeyPath:@"version" toAttribute:@"version"];
[gatewayMapping mapKeyPath:@"macWifi" toAttribute:@"macWifi"];
[gatewayMapping mapKeyPath:@"macEthernet" toAttribute:@"macEthernet"];
[gatewayMapping mapKeyPath:@"updateDate" toAttribute:@"updateDate"];
[gatewayMapping mapKeyPath:@"muteMode" toAttribute:@"muteMode"];
[gatewayMapping mapKeyPath:@"timezone" toAttribute:@"timezone"];

RKObjectMapping *authReturnMapping = [RKObjectMapping mappingForClass:[VOAuth class]];
[authReturnMapping mapKeyPath:@"sessionId" toAttribute:@"sessionId"];
[authReturnMapping mapKeyPath:@"user" toRelationship:@"user" withMapping:userMapping];
[authReturnMapping mapKeyPath:@"gateway" toRelationship:@"gateway" withMapping:gatewayMapping];
[[RKObjectManager sharedManager].mappingProvider setMapping:authReturnMapping forKeyPath:@""];
[[RKObjectManager sharedManager].mappingProvider setSerializationMapping:[authReturnMapping inverseMapping] forClass:[VOAuth class]]; 

NSLog(@"LOGIN SEND --------------------------------");    
SOAuth *logObj = [[SOAuth alloc]init];
logObj.login = @"clientTest";
logObj.password = @"216a2e1269b5daaa35fd911964e5a86ce11f267d";

RKObjectMapping* authhMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[VOAuth class] ];
[[RKObjectManager sharedManager] postObject:logObj mapResponseWith:authhMapping delegate:nil];
}

- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects {
//RKLogInfo(@"Load collection of Articles: %@", objects);
NSLog(@"LOGIN OK --------------------------------");
}

- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error {
NSLog(@"LOGIN KO --------------------------------");
}

@end

我想强调几点:

  • [[RKObjectManager sharedManager].mappingProvider setMapping:authReturnMapping forKeyPath:@""] :我有我的全局对象映射的空键,因为我没有它的根键...

  • [[RKObjectManager shareManager] postObject:logObj mapResponseWith:authhMapping delegate:nil];我的委托为零,否则我的应用程序崩溃...

日志:

2011-11-02 11:04:50.824 RestKit Installation[3701:207] D restkit.network:RKClient.m:265 Reachability observer changed for client <RKClient: 0x6d06e10>, suspending queue (null) until reachability to host '0.0.0.0' can be determined
2011-11-02 11:04:50.827 RestKit Installation[3701:207] LOGIN SEND --------------------------------
2011-11-02 11:04:50.833 RestKit Installation[3701:207] D restkit.network:RKClient.m:378 Reachability to host '0.0.0.0' determined for client <RKClient: 0x6d06e10>, unsuspending queue <RKRequestQueue: 0x6d09c10 name=(null) suspended=YES requestCount=1 loadingCount=0/5>
2011-11-02 11:04:50.836 RestKit Installation[3701:207] D restkit.network:RKRequest.m:334 Sending asynchronous POST request to URL http://mydomain.dev/ui/v1/auth.
2011-11-02 11:04:50.836 RestKit Installation[3701:207] D restkit.network:RKObjectLoader.m:302 POST or PUT request for source object <SOAuth: 0x9001540>, serializing to MIME Type application/json for transport...
2011-11-02 11:04:50.838 RestKit Installation[3701:207] T restkit.network:RKRequest.m:282 Prepared POST URLRequest '<NSMutableURLRequest http://mydomain.dev/ui/v1/auth>'. HTTP Headers: {
Accept = "application/json";
"Content-Length" = 75;
"Content-Type" = "application/json";
}. HTTP Body:       {"login":"clientTest","password":"216a2e1269b5daaa35fd911964e5a86ce11f267d"}.
2011-11-02 11:04:51.432 RestKit Installation[3701:207] D restkit.network:RKResponse.m:196 NSHTTPURLResponse Status Code: 200
2011-11-02 11:04:51.433 RestKit Installation[3701:207] D restkit.network:RKResponse.m:197 Headers: {
Connection = close;
"Content-Length" = 763;
"Content-Type" = "application/json";
Date = "Wed, 02 Nov 2011 10:04:57 GMT";
}
2011-11-02 11:04:51.434 RestKit Installation[3701:207] T restkit.network:RKResponse.m:202 Read response body: {"sessionId":"DA93D5ECD8E338AA27800794EEB9C20F","user":{"id":3,"ref":"2461498766","login":"clientTest","mail":"[email protected]","phone":"client127","subId":3,"creation":"29/03/2010 10:33:24","language":"en","firstConnection":"30/03/2010 16:42:07","lastConnection":"02/11/2011 09:36:43","connectionStep":"6"},"gateway":{"id":3,"serial":"testserial","status":"A","led":"START","ref":"DJJHGGGG00009","type":"FULL","ip":"192.168.44.168","connection":"","initDate":1290694795533,"activationDate":1290694795533,"manufacDate":1269851384000,"imei":"354482020013035","model":"TYLOP","firmware":"1.3.1","version":"","macWifi":"...","macEthernet":"...","updateDate":1310053274000,"muteMode":"","timezone":""}}
2011-11-02 11:04:51.438 RestKit Installation[3701:6003] D restkit.network:RKObjectLoader.m:210 Found directly configured object mapping, creating temporary mapping provider for keyPath '%@'

最后,

我的回调函数没有被调用:

  • (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects

  • (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error

希望有人可以帮助我,

TY。

Hi all it's my first post in stack-overflow,

So First, thank you very much to everyone who shares!

My problems are :

  • I dont have callback return when I use RKObjectManager for POST Serialized object.
  • And I don't know if my use of Mapping data is correct ...

So I show you the result of my restful service (formated in JSON), my code and my restkit Logs

{"sessionId":"DA93D5ECD8E338AA27800794EEB9C20F","user":{"id":3,"ref":"2461498766","login":"clientTest","mail":"[email protected]","phone":"client127","subId":3,"creation":"29/03/2010 10:33:24","language":"en","firstConnection":"30/03/2010 16:42:07","lastConnection":"02/11/2011 09:36:43","connectionStep":"6"},"gateway":{"id":3,"serial":"testserial","status":"A","led":"START","ref":"DJJHGGGG00009","type":"FULL","ip":"192.168.44.168","connection":"","initDate":1290694795533,"activationDate":1290694795533,"manufacDate":1269851384000,"imei":"354482020013035","model":"TYLOP","firmware":"1.3.1","version":"","macWifi":"...","macEthernet":"...","updateDate":1310053274000,"muteMode":"","timezone":""}}

As you can see, we have a global Object with inside : User, Gateway Objects.

VOAuth.h, my global object used for data mapping :

#import "VOUser.h"
#import "VOGateway.h"

@interface VOAuth : NSObject
@property (nonatomic, retain) NSString * sessionId;
@property (nonatomic, retain) VOUser * user;
@property (nonatomic, retain) VOGateway * gateway;
@end

VOGateway.h,

#import <Foundation/Foundation.h>

@interface VOGateway : NSObject

@property (nonatomic, retain) NSString * identifier;
@property (nonatomic, retain) NSString * serial;
@property (nonatomic, retain) NSString * status;
@property (nonatomic, retain) NSString * led;
@property (nonatomic, retain) NSString * ref;
@property (nonatomic, retain) NSString * type;
@property (nonatomic, retain) NSString * ip;
@property (nonatomic, retain) NSString * connection;
@property (nonatomic, retain) NSString * initDate;
@property (nonatomic, retain) NSString * activationDate;
@property (nonatomic, retain) NSString * manufacDate;
@property (nonatomic, retain) NSString * imei;
@property (nonatomic, retain) NSString * model;
@property (nonatomic, retain) NSString * firmware;
@property (nonatomic, retain) NSString * version;
@property (nonatomic, retain) NSString * macWifi;
@property (nonatomic, retain) NSString * macEthernet;
@property (nonatomic, retain) NSString * updateDate;
@property (nonatomic, retain) NSString * muteMode;
@property (nonatomic, retain) NSString * timezone;

@end

VOUser.h,

#import <Foundation/Foundation.h>

@interface VOUser : NSObject

@property (nonatomic, retain) NSString * identifier;
@property (nonatomic, retain) NSString * ref;
@property (nonatomic, retain) NSString * login;
@property (nonatomic, retain) NSString * mail;
@property (nonatomic, retain) NSString * phone;
@property (nonatomic, retain) NSString * subId;
@property (nonatomic, retain) NSString * creation;
@property (nonatomic, retain) NSString * language;
@property (nonatomic, retain) NSString * firstConnection;
@property (nonatomic, retain) NSString * lastConnection;
@property (nonatomic, retain) NSString * connectionStep;

@end

SOAuth.h (my serialized object used as parameters for my call),

#import <Foundation/Foundation.h>

@interface SOAuth : NSObject
@property (nonatomic, retain) NSString* login;
@property (nonatomic, retain) NSString* password;
@end

MAModule.h (My manger, i call my restfull service here),

#import <Foundation/Foundation.h>
#import <RestKit/RestKit.h>
#import "VOUser.h"
#import "VOGateway.h"
#import "VOAuth.h"
#import "SOAuth.h"
@interface MAModule : NSObject <RKObjectLoaderDelegate>
-(void)sendLogIn;
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects;
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error;
@end

MAModule.m,

#import "MAModule.h"

@implementation MAModule

-(void)sendLogIn
{

RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);

RKObjectManager* manager = [RKObjectManager    objectManagerWithBaseURL:@"http://mydomain.dev/ui/v1"];
[RKObjectManager sharedManager].serializationMIMEType = RKMIMETypeJSON;
[manager.router routeClass:[SOAuth class] toResourcePath:@"/auth" forMethod:RKRequestMethodPOST];

RKObjectMapping* authSerializationMapping = [RKObjectMapping mappingForClass:[NSMutableDictionary class] ];
[authSerializationMapping mapAttributes:@"login", @"password", nil];
[[RKObjectManager sharedManager].mappingProvider setSerializationMapping:authSerializationMapping forClass:[SOAuth class] ];

RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[VOUser class]];
[userMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[userMapping mapKeyPath:@"ref" toAttribute:@"ref"];
[userMapping mapKeyPath:@"login" toAttribute:@"login"];
[userMapping mapKeyPath:@"mail" toAttribute:@"mail"];
[userMapping mapKeyPath:@"phone" toAttribute:@"phone"];
[userMapping mapKeyPath:@"subId" toAttribute:@"subId"];
[userMapping mapKeyPath:@"creation" toAttribute:@"creation"];
[userMapping mapKeyPath:@"language" toAttribute:@"language"];
[userMapping mapKeyPath:@"firstConnection" toAttribute:@"firstConnection"];
[userMapping mapKeyPath:@"lastConnection" toAttribute:@"lastConnection"];
[userMapping mapKeyPath:@"connectionStep" toAttribute:@"connectionStep"];


RKObjectMapping *gatewayMapping = [RKObjectMapping mappingForClass:[VOGateway class]];
[gatewayMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[gatewayMapping mapKeyPath:@"serial" toAttribute:@"serial"];
[gatewayMapping mapKeyPath:@"status" toAttribute:@"status"];
[gatewayMapping mapKeyPath:@"led" toAttribute:@"led"];
[gatewayMapping mapKeyPath:@"ref" toAttribute:@"ref"];
[gatewayMapping mapKeyPath:@"type" toAttribute:@"type"];
[gatewayMapping mapKeyPath:@"ip" toAttribute:@"ip"];
[gatewayMapping mapKeyPath:@"connection" toAttribute:@"connection"];
[gatewayMapping mapKeyPath:@"initDate" toAttribute:@"initDate"];
[gatewayMapping mapKeyPath:@"activationDate" toAttribute:@"activationDate"];
[gatewayMapping mapKeyPath:@"manufacDate" toAttribute:@"manufacDate"];
[gatewayMapping mapKeyPath:@"imei" toAttribute:@"imei"];
[gatewayMapping mapKeyPath:@"model" toAttribute:@"model"];
[gatewayMapping mapKeyPath:@"firmware" toAttribute:@"firmware"];
[gatewayMapping mapKeyPath:@"version" toAttribute:@"version"];
[gatewayMapping mapKeyPath:@"macWifi" toAttribute:@"macWifi"];
[gatewayMapping mapKeyPath:@"macEthernet" toAttribute:@"macEthernet"];
[gatewayMapping mapKeyPath:@"updateDate" toAttribute:@"updateDate"];
[gatewayMapping mapKeyPath:@"muteMode" toAttribute:@"muteMode"];
[gatewayMapping mapKeyPath:@"timezone" toAttribute:@"timezone"];

RKObjectMapping *authReturnMapping = [RKObjectMapping mappingForClass:[VOAuth class]];
[authReturnMapping mapKeyPath:@"sessionId" toAttribute:@"sessionId"];
[authReturnMapping mapKeyPath:@"user" toRelationship:@"user" withMapping:userMapping];
[authReturnMapping mapKeyPath:@"gateway" toRelationship:@"gateway" withMapping:gatewayMapping];
[[RKObjectManager sharedManager].mappingProvider setMapping:authReturnMapping forKeyPath:@""];
[[RKObjectManager sharedManager].mappingProvider setSerializationMapping:[authReturnMapping inverseMapping] forClass:[VOAuth class]]; 

NSLog(@"LOGIN SEND --------------------------------");    
SOAuth *logObj = [[SOAuth alloc]init];
logObj.login = @"clientTest";
logObj.password = @"216a2e1269b5daaa35fd911964e5a86ce11f267d";

RKObjectMapping* authhMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[VOAuth class] ];
[[RKObjectManager sharedManager] postObject:logObj mapResponseWith:authhMapping delegate:nil];
}

- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects {
//RKLogInfo(@"Load collection of Articles: %@", objects);
NSLog(@"LOGIN OK --------------------------------");
}

- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error {
NSLog(@"LOGIN KO --------------------------------");
}

@end

I would like to highlight few points :

  • [[RKObjectManager sharedManager].mappingProvider setMapping:authReturnMapping forKeyPath:@""] : I have an empty key for my global object mapping, because I don't have root key for it ...

  • [[RKObjectManager sharedManager] postObject:logObj mapResponseWith:authhMapping delegate:nil]; My delegate is nil, else my application crash ...

LOGS :

2011-11-02 11:04:50.824 RestKit Installation[3701:207] D restkit.network:RKClient.m:265 Reachability observer changed for client <RKClient: 0x6d06e10>, suspending queue (null) until reachability to host '0.0.0.0' can be determined
2011-11-02 11:04:50.827 RestKit Installation[3701:207] LOGIN SEND --------------------------------
2011-11-02 11:04:50.833 RestKit Installation[3701:207] D restkit.network:RKClient.m:378 Reachability to host '0.0.0.0' determined for client <RKClient: 0x6d06e10>, unsuspending queue <RKRequestQueue: 0x6d09c10 name=(null) suspended=YES requestCount=1 loadingCount=0/5>
2011-11-02 11:04:50.836 RestKit Installation[3701:207] D restkit.network:RKRequest.m:334 Sending asynchronous POST request to URL http://mydomain.dev/ui/v1/auth.
2011-11-02 11:04:50.836 RestKit Installation[3701:207] D restkit.network:RKObjectLoader.m:302 POST or PUT request for source object <SOAuth: 0x9001540>, serializing to MIME Type application/json for transport...
2011-11-02 11:04:50.838 RestKit Installation[3701:207] T restkit.network:RKRequest.m:282 Prepared POST URLRequest '<NSMutableURLRequest http://mydomain.dev/ui/v1/auth>'. HTTP Headers: {
Accept = "application/json";
"Content-Length" = 75;
"Content-Type" = "application/json";
}. HTTP Body:       {"login":"clientTest","password":"216a2e1269b5daaa35fd911964e5a86ce11f267d"}.
2011-11-02 11:04:51.432 RestKit Installation[3701:207] D restkit.network:RKResponse.m:196 NSHTTPURLResponse Status Code: 200
2011-11-02 11:04:51.433 RestKit Installation[3701:207] D restkit.network:RKResponse.m:197 Headers: {
Connection = close;
"Content-Length" = 763;
"Content-Type" = "application/json";
Date = "Wed, 02 Nov 2011 10:04:57 GMT";
}
2011-11-02 11:04:51.434 RestKit Installation[3701:207] T restkit.network:RKResponse.m:202 Read response body: {"sessionId":"DA93D5ECD8E338AA27800794EEB9C20F","user":{"id":3,"ref":"2461498766","login":"clientTest","mail":"[email protected]","phone":"client127","subId":3,"creation":"29/03/2010 10:33:24","language":"en","firstConnection":"30/03/2010 16:42:07","lastConnection":"02/11/2011 09:36:43","connectionStep":"6"},"gateway":{"id":3,"serial":"testserial","status":"A","led":"START","ref":"DJJHGGGG00009","type":"FULL","ip":"192.168.44.168","connection":"","initDate":1290694795533,"activationDate":1290694795533,"manufacDate":1269851384000,"imei":"354482020013035","model":"TYLOP","firmware":"1.3.1","version":"","macWifi":"...","macEthernet":"...","updateDate":1310053274000,"muteMode":"","timezone":""}}
2011-11-02 11:04:51.438 RestKit Installation[3701:6003] D restkit.network:RKObjectLoader.m:210 Found directly configured object mapping, creating temporary mapping provider for keyPath '%@'

Finally,

My callback functions are not called :

  • (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects

  • (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error

Hoping someone can help me,

TY.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

始于初秋 2024-12-20 01:30:19

您的方法不会被调用,因为您将 nil 设置为您的委托。根据我们后面的讨论,如果 self 作为委托传递,则随后的崩溃是由于 MAModule 过早释放而导致的。使用属性或单例模式保留 MAModule 对象至少直到您的请求完成。

Your methods are not called, because you set nil as your delegate. As per our later discussion, if self is passed as the delegate, the subsequent crash is caused by MAModule being released too early. Use either property or singleton pattern to retain the MAModule object at least until your requests are completed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文