流星iOS DDP包由martin,如何用用户名登录

时间:2015-08-19 18:03:06

标签: ios meteor meteor-accounts ddp

我正在使用此DDP程序包从我的iOS应用程序登录:

https://github.com/martijnwalraven/meteor-ios/

但我只能找到一个名为loginWithEmail的方法。

https://github.com/martijnwalraven/meteor-ios/blob/affe8d13a876a0e6e7c95656339d496cbc54a649/Meteor/METDDPClient%2BAccountsPassword.m

如何编辑,以便我可以使用用户名登录?

1 个答案:

答案 0 :(得分:1)

你必须亲自制作方法。

查找METDDPClient + AccountsPassword.h和.m

在.h你

- (void)loginWithUsername:(NSString *)username password:(NSString *)password completionHandler:(nullable METLogInCompletionHandler)completionHandler;

然后在.m

- (void)loginWithUsername:(NSString *)username password:(NSString *)password completionHandler:(METLogInCompletionHandler)completionHandler{
   [self loginWithMethodName:@"login" parameters:@[@{@"user": @{@"username": username}, @"password": @{@"digest": [password SHA256String], @"algorithm": @"sha-256"}}] completionHandler:completionHandler];
}