0

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

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

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

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

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

4

1 回答 1

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];
}
于 2015-09-09T07:55:31.667 回答