测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可协议 | MIT |
发布最新发布 | 2015年11月 |
由 Vincent Tourraine 维护。
依赖 | |
AFOAuth1Client | ~> 1.0.0 |
TBXML | ~> 1.5 |
ISO8601DateFormatter | ~> 0.7 |
用于 Zotero API 的 Objective-C 客户端。
这仍然处于开发初期,因此在使用它以生产应用时请谨慎行事。此时的任何错误报告、特性请求或一般反馈都将受到高度赞赏。
SZNZotero 是一个针对 iOS 和 Mac OS X 的 Zotero API 客户端,基于 AFNetworking 构建。
CocoaPods 是推荐将 SZNZotero 添加到项目的工具。CocoaPods 是 Objective-C 的依赖管理器,自动化并简化了在项目中使用第三方库(如 SZNZotero)的过程。
以下是一个示例 podfile,展示了如何安装 SZNZotero 及其所有依赖项。
platform :ios, '5.0'
pod 'SZNZotero', '~> 0.3.4'
Zotero API v2 使用 3 步OAuth 1.0 认证。为了获取受保护资源,你的应用程序将打开 Mobile Safari 并提示用户凭据。然后 iOS 将回到你的应用程序使用自定义 URL schema。这意味着你需要在 Xcode 项目中设置此配置。
#import "AFOAuth1Client.h"
NSString * const SZNURLScheme = @"##my_URL_scheme##";
(…)
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
if ([url.scheme isEqualToString:SZNURLScheme]) {
NSNotification *notification = [NSNotification notificationWithName:kAFApplicationLaunchedWithURLNotification object:nil userInfo:@{kAFApplicationLaunchOptionsURLKey: url}];
[[NSNotificationCenter defaultCenter] postNotification:notification];
}
return YES;
}
你需要使用你的 API 客户端密钥和密钥进行 Zotero API 客户端实例化
NSString *clientKey = @"###my_consumer_key###";
NSString *clientSecret = @"###my_consumer_secret###";
SZNZoteroAPIClient *client = [[SZNZoteroAPIClient alloc] initWithKey:clientKey secret:clientSecret URLScheme:SZNURLScheme];
如果你没有客户端密钥和密钥,你必须在 Zotero 中注册你的应用程序。
SZNCollection *parentCollection = ...;
[parentCollection fetchTopItemsSuccess:^(NSArray *items) {
/* ... */
} failure:^(NSError *error) {
/* ... */
}];
SZNLibrary *library = ...;
NSDictionary *itemFields = ...;
[SZNItem createItemInLibrary:library content:itemFields success:^(SZNItem *newItem) {
/* ... */
} failure:^(NSError *error) {
/* ... */
}];
SZNZotero 需要 Xcode 4.4、iOS 5.0 或 Mac OS X 10.7 中的一个,以及 AFNetworking、AFOAuth1Client、TBXML 和 ISO8601DateFormatter。SZNZotero 使用 ARC。
SZNZotero 由 shazino 开发。
SZNZotero 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。