Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The Drupal iOS Software Development Kit provides a full suite of iOS methods to natively connect iOS applications to Drupal 7 and 8.

Merge pull request #113 from gitter-badger/gitter-badge

Add a Gitter chat badge to README.md
latest commit a75d01a562
Kyle Browning authored

README.md

Drupal iOS SDK - Connect your iOS/OS X app to Drupal


built by Kyle Browning

Introduction


Join the chat at https://gitter.im/kylebrowning/drupal-ios-sdk The Drupal iOS SDK is a standard set of libraries for communicating to Drupal from any iOS device. Its extremely simple, and is basically a wrapper for AFNetworking. It combines the most used commands to communicate with Drupal and handles session managment for you(but it doesnt store passwords or persist CSRF/oAUTH tokens, you must do that(at least yet :))

Installation


Create a pod file with (this will keep you on the 3.0 releases which is Drupal 8 specific)

 pod 'drupal-ios-sdk', '~> 3.0'

Then run

pod install

Requirements

DIOS Version Drupal Version Min iOS Target Notes
3.x Drupal 8 iOS 7.0
2.x Drupal 6-7 iOS 5.0 Requires Services module

Configuration


In Drupal 8 things are a bit different, but much easier.

First steps

 DIOSSession *sharedSession = [DIOSSession sharedSession];
 [sharedSession setBaseURL:[NSURL URLWithString:@"http://d8"]];
 [sharedSession setBasicAuthCredsWithUsername:@"admin" andPassword:@"pass"];

Currently 3.x only supports basic auth but will support oAuth soon

Quick Examples


 //create new user
 NSDictionary *user = @{@"name":@[@{@"value":@"username"}],@"mail":@[@{@"value":@"email@gmail.com"}],@"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];

Extras


Drupal iOS SDK Addons

OAuth


Coming soon

Troubleshooting


If you are getting Forbidden, you probably havnt setup your permissions.

Questions


Checkout the Issue queue, or email me Email kylebrowning@me.com

Something went wrong with that request. Please try again.