测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可 | 自定义 |
发布上次发布 | 2014年12月 |
由 Deyton Sehn 维护。
依赖关系 | |
AKANetworkLogging | ~> 0.1 |
DSTextEntryValidation | ~> 1.0 |
Mantle | ~> 1.4 |
TPKeyboardAvoiding | ~> 1.2 |
此 BETA SDK 基于我们的公共 REST API,为开发者提供了一种简单快捷的方法,可以将 DocuSign 的世界级文档签署体验添加到其原生 iOS 应用中。
警告:此 DocuSign iOS SDK 的 beta 版本正在积极开发中,接口仍在细化。请在生产环境中自行承担使用风险。
您可以在 DocuSign DevCenter 使用此 注册 创建一个免费的开发者帐户。您将需要开发者帐户中的 集成密钥 来使用 DocuSign iOS SDK。
请参阅 常用术语 以了解 DocuSign 平台的基本组件。
要使用 DocuSign iOS SDK,您可以使用以下方法导入所需的所有内容
#import <DocuSign-iOS-SDK/DocuSign-iOS-SDK.h>
根据您的工作流程如何与 DocuSign 集成,有多种身份验证选项。
如果用户已经有 DocuSign 账户,您可以展示一个 DSLoginViewController
并接收一个授权的 DSSessionManager
实例。
首先,展示 DSLoginViewController
DSLoginViewController *loginViewController = [[DSLoginViewController alloc] initWithIntegratorKey:@"<#IntegratorKey#>"
forEnvironment:DSRestAPIEnvironmentDemo
email:@"<#email#>" //This will pre-populate the UI
delegate:self];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:loginViewController];
[self presentViewController:navController animated:YES completion:nil];
然后实现 DSLoginViewControllerDelegate
方法
- (void)loginViewController:(DSLoginViewController *)controller didLoginWithSessionManager:(DSSessionManager *)sessionManager {
self.sessionManager = sessionManager;
[self dismissViewControllerAnimated:YES completion:nil];
// Make API calls!
}
- (void)loginViewControllerCancelled:(DSLoginViewController *)controller {
[self dismissViewControllerAnimated:YES completion:nil];
}
如果您的应用已经与 DocuSign 集成,您可能已经通过其他某种方式进行了身份验证。我们支持两种程序化身份验证方法。
使用 DocuSign OAuth 令牌
self.sessionManager = [[DSSessionManager alloc] initWithIntegratorKey:@"<#IntegratorKey#>"
forEnvironment:DSRestAPIEnvironmentDemo
authToken:@"<#AuthToken#>"
authDelegate:self];
[self.sessionManager authenticate];
使用用户名和密码
self.sessionManager = [[DSSessionManager alloc] initWithIntegratorKey:@"<#IntegratorKey#>"
forEnvironment:DSRestAPIEnvironmentDemo
username:@"<#email#>"
password:@"<#password#>"
authDelegate:self];
[self.sessionManager authenticate];
当会话管理者获得身份验证结果时,它将回调到在 authDelegate:
中指定的代理,之后您就可以使用 SDK 的其他功能了。如果用户属于多个 DocuSign 账户,这些方法将使用默认账户进行身份验证。如果您希望选择特定的账户,请实现可选的代理方法 -sessionManager:chooseAccountIDFromAvailableAccounts:completeAuthenticationHandler
。
DSSigningViewController
)如果您在其他地方创建了文档套件并且已经拥有了 envelopeId
或 recipientId
,您可以简单地展示一个 DSSigningViewController
DSSigningViewController *signingViewController = [self.sessionManager signingViewControllerForRecipientWithID:@"<#recipientId#>"
inEnvelopeWithID:@"<#envelopeId#>"
delegate:self];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:signingViewController];
[self presentViewController:navController animated:YES completion:nil];
如果您有一个需要签署的文件,创建一个 DocuSign 文档套件并展示一个 DSSigningViewController
[self.sessionManager startCreateSelfSignEnvelopeTaskWithFileName:@"<#NewFileName#>" fileURL:<#LocalFileURL#> completionHandler:^(DSCreateEnvelopeResponse *response, NSError *error) {
if (error) {
// Handle the error
return;
}
DSSigningViewController *signingViewController = [self.sessionManager signingViewControllerForRecipientWithID:nil
inEnvelopeWithID:response.envelopeID
delegate:self];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:signingViewController];
[self presentViewController:navController animated:YES completion:nil];
}];
DSSigningViewControllerDelegate
- (void)signingViewController:(DSSigningViewController *)signingViewController completedWithStatus:(DSSigningCompletedStatus)status {
[self dismissViewControllerAnimated:YES completion:^{
switch (status) {
case DSSigningCompletedStatusSigned: {
// Handle signed envelope
break;
}
case DSSigningCompletedStatusDeferred:
// Handle deferred envelope
break;
case DSSigningCompletedStatusDeclined:
// Handle declined envelope
break;
}
}];
}
- (void)signingViewController:(DSSigningViewController *)signingViewController failedWithError:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:^{
// handle error
}];
}
DocuSign iOS SDK 在 DOCUSIGN Mobile iOS SDK LICENSE 下授权。