Skip to content
This repository

Objective-C client for the Mendeley Open API.

tag: 1.2
README.md

MendeleySDK

Objective-C client for the Mendeley Open API.

This is still in early stages of development, so proceed with caution when using this in a production application. Any bug reports, feature requests, or general feedback at this point would be greatly appreciated.

MendeleySDK is a Mendeley API client for iOS and Mac OS X. It’s built on top of AFNetworking and AFOAuth1Client to deal with network operations and authentication.

Demo app screenshot paperDemo app screenshot publication

Getting Started

Installation

CocoaPods is the recommended way to add MendeleySDK to your project.

Here’s an example podfile that installs MendeleySDK and its dependency, AFOAuth1Client.

platform :ios, '5.0'

pod 'MendeleySDK', '1.2'

App credentials

Define your API consumer key and secret (in your AppDelegate.m, for instance):

NSString * const MDLConsumerKey    = @"###my_consumer_key###";
NSString * const MDLConsumerSecret = @"###my_consumer_secret###";

If you don’t have a consumer key and secret, go to the Mendeley Developers Portal and register your application first.

OAuth callback URL

The Mendeley Open API uses 3leg OAuth 1.0 authentication. In order to gain access to protected resources, your application will open Mobile Safari and prompt for user credentials. iOS will then switch back to your application using a custom URL scheme. It means that you need to set it up in your Xcode project.

  • Open the project editor, select your main target, click the Info button.
  • Add a URL Type, and type a unique URL scheme (for instance ’mymendeleyclient’).

Xcode URL types

  • Update your app delegate to notify MendeleySDK as following:
#import "AFOAuth1Client.h"

NSString * const MDLURLScheme = @"##my_URL_scheme##";

()

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    if ([[url scheme] isEqualToString:MDLURLScheme])
    {
        NSNotification *notification = [NSNotification notificationWithName:kAFApplicationLaunchedWithURLNotification object:nil userInfo:@{kAFApplicationLaunchOptionsURLKey: url}];
        [[NSNotificationCenter defaultCenter] postNotification:notification];
    }

    return YES;
}

Note: you can skip this step if you only use public resources

Okay, you should be ready to go now! You can also take a look at the demo iOS app and see how things work.

Examples

How to create a new document

[MDLDocument createNewDocumentWithTitle:@"title" success:^(MDLDocument *document) {
     /* ... */
} failure:^(NSError *error) {
    /* ... */
}];

How to upload a file

MDLDocument *document;
[document uploadFileAtURL:localFileURL success:^() {
    /* ... */
} failure:^(NSError *error) {
    /* ... */
}];

References

Requirements

MendeleySDK requires Xcode 4.4 with either the iOS 5.0 or Mac OS 10.6 (64-bit with modern Cocoa runtime) SDK, as well as AFOAuth1Client.

Credits

MendeleySDK is developed by shazino.

License

MendeleySDK is available under the MIT license. See the LICENSE file for more info.

Something went wrong with that request. Please try again.