使用 ObjectiveDropboxOfficial 框架获取用户信息
Getting user infos using ObjectiveDropboxOfficial framework
我正在使用 ObjectiveDropboxOfficial 框架在 Objective-C 应用程序中集成 Dropbox(由于 v1 dropbox api 已弃用)。
Framework link
我正在尝试登录保管箱用户信息(电子邮件、姓名等)。这是我的代码:
DropboxClient *client=[DropboxClientsManager authorizedClient];
[[client.usersRoutes getCurrentAccount]
response:^_Nonnull(DBUSERSBasicAccount *response, DBError *dberror)
{
// loginLabel.text=[NSString stringWithFormat: @"%@\n%@", account.name, account.email];
return response;
}
}];
此代码不起作用,另外会导致 xcode 出现奇怪的错误:enter image description here
方法定义为:
- (DBRpcTask<DBUSERSBasicAccount *, DBUSERSGetAccountError *> *_Nonnull) getAccount:(NSString *_Nonnull)accountId;
- (DBRpcTask<TResponse, TError> *_Nonnull)response:
(void (^_Nonnull)(TResponse _Nullable, TError _Nullable,
DBError *_Nullable))responseBlock;
我被这个问题困扰了一整天,如有任何帮助,我们将不胜感激:
1- 如何使用框架获取用户信息,或
2- 是什么导致了错误,应该如何调用 Nonnull 方法?
提前致谢
经过 2 天的努力,我终于找到了答案:
DropboxClient *client = [DropboxClientsManager authorizedClient];
if(client)
{
[[client.usersRoutes getCurrentAccount] response:^(DBUSERSFullAccount *account, DBNilObject *obj, DBError *error) {
if (error != nil) {
NSLog(@"Error %@", error.errorContent);
}
if (account != nil) {
NSLog(@"User's name %@", account.name.displayName);
}
if(self.hud)
[self.hud hideAnimated:YES];
}];
我希望这会节省其他开发人员的精力和心理健康:)
我正在使用 ObjectiveDropboxOfficial 框架在 Objective-C 应用程序中集成 Dropbox(由于 v1 dropbox api 已弃用)。 Framework link
我正在尝试登录保管箱用户信息(电子邮件、姓名等)。这是我的代码:
DropboxClient *client=[DropboxClientsManager authorizedClient];
[[client.usersRoutes getCurrentAccount]
response:^_Nonnull(DBUSERSBasicAccount *response, DBError *dberror)
{
// loginLabel.text=[NSString stringWithFormat: @"%@\n%@", account.name, account.email];
return response;
}
}];
此代码不起作用,另外会导致 xcode 出现奇怪的错误:enter image description here 方法定义为:
- (DBRpcTask<DBUSERSBasicAccount *, DBUSERSGetAccountError *> *_Nonnull) getAccount:(NSString *_Nonnull)accountId;
- (DBRpcTask<TResponse, TError> *_Nonnull)response:
(void (^_Nonnull)(TResponse _Nullable, TError _Nullable,
DBError *_Nullable))responseBlock;
我被这个问题困扰了一整天,如有任何帮助,我们将不胜感激: 1- 如何使用框架获取用户信息,或 2- 是什么导致了错误,应该如何调用 Nonnull 方法?
提前致谢
经过 2 天的努力,我终于找到了答案:
DropboxClient *client = [DropboxClientsManager authorizedClient];
if(client)
{
[[client.usersRoutes getCurrentAccount] response:^(DBUSERSFullAccount *account, DBNilObject *obj, DBError *error) {
if (error != nil) {
NSLog(@"Error %@", error.errorContent);
}
if (account != nil) {
NSLog(@"User's name %@", account.name.displayName);
}
if(self.hud)
[self.hud hideAnimated:YES];
}];
我希望这会节省其他开发人员的精力和心理健康:)