我正在使用此DDP程序包从我的iOS应用程序登录:
https://github.com/martijnwalraven/meteor-ios/
但我只能找到一个名为loginWithEmail的方法。
如何编辑,以便我可以使用用户名登录?
答案 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];
}