测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | 自定义 |
发布上次发布 | 2016年7月 |
SPM支持 SPM | ✗ |
由 Kyle Browning 维护。
依赖关系 | |
Alamofire | >= 0 |
SwiftyJSON | >= 0 |
Drupal iOS SDK 是一套标准的库,用于从任何 iOS 设备与 Drupal 通信。它非常简单,基本上是 AFNetworking 的包装。它结合了与 Drupal 通信-most commonly used 命令,并为您处理会话管理(除了 oauth)
DIOS 版本 | Drupal 版本 | 最小 iOS 目标 | 注意 |
---|---|---|---|
3.x | Drupal 8 | iOS 7.0 | |
2.x | Drupal 6-7 | iOS 5.0 | 需要 Services 模块 |
创建一个包含以下内容的 pod 文件(这将保持您在 3.0 版本上,它是 Drupal 8 特定的)
pod 'drupal-ios-sdk', '~> 3.0'
然后执行
pod install
在 Drupal 8 中,事情有些不同,但更容易。
DIOSSession *sharedSession = [DIOSSession sharedSession];
[sharedSession setBaseURL:[NSURL URLWithString:@"http://d8"]];
[sharedSession setBasicAuthCredsWithUsername:@"admin" andPassword:@"pass"];
//If you want to change the request format
//Defaults to json
[sharedSession setRequestFormat:@"hal+json"];
目前 3.x 仅支持基本认证,但将很快支持 OAuth
//create new user
NSDictionary *user = @{@"name":@[@{@"value":@"username"}],@"mail":@[@{@"value":@"[email protected]"}],@"pass":@[@{@"value":@"passw0rd"}]};
[DIOSUser createUserWithParams:user success:nil failure:nil];
//update existing node
NSDictionary *node = @{@"uid":@[@{@"target_id":@"1"} ],@"body":@[@{@"value":@"Updated BOdy ",@"format":@"full_html"}],@"title":@[@{@"value":@"Updated Title"}]};
[DIOSNode patchNodeWithID:@"12" params:node type:@"page" success:nil failure:nil];
//create new comment
NSDictionary *parameters = @{@"subject":@[@{@"value":@"comment title"}],@"comment_body":@[@{@"value":@"a new body",@"format":@"basic_html"}]};
[DIOSComment createCommentWithParams:parameters relationID:@"7" type:@"comment" success:nil failure:nil];
//get a user
[DIOSUser getUserWithID:@"1" success:nil failure:nil];
//delete a node
[DIOSNode deleteNodeWithID:@"13" success:nil failure:nil];
即将推出
如果您收到禁止访问的提示,那么您可能还没有设置您的权限。
查看问题队列,或给我发电子邮件 电子邮箱[email protected]