Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Objective-C client for the Mendeley API.
Objective-C Shell Other
tag: 0.3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
AFOAuth1Client @ c3934a3
Examples/MendeleySDKDemo
MendeleySDK
.gitignore
.gitmodules
CONTRIBUTING.md
LICENSE
README.md

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 paper Demo app screenshot publication

Getting Started

Download

Using Git, you can download MendeleySDK (dependencies included) with just one command line.

git clone --recursive git@github.com:shazino/MendeleySDK.git

Installation

1/ Create a new project with Xcode (with ARC enabled).

2/ Drag and drop the following files into your project navigator.

  • MendeleySDK/MendeleySDK/*
  • MendeleySDK/AFOAuth1Client/AFOAuth1Client.h
  • MendeleySDK/AFOAuth1Client/AFOAuth1Client.m
  • MendeleySDK/AFOAuth1Client/AFNetworking/AFNetworking/*

3/ At this point, AFOAuth1Client and AFNetworking don’t use ARC, so you’ll need to set the -fno-objc-arc compiler flag for all their files (as explained here).

Disable ARC for AFOAuth1Client and AFNetworking

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

NSString * const kMDLConsumerKey    = @"###my_consumer_key###";
NSString * const kMDLConsumerSecret = @"###my_consumer_secret###";

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

5/ 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 it set 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 kMDLURLScheme = @"##INSERT-URL-SCHEME-HERE##";

(…)

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    if ([[url scheme] isEqualToString:kMDLURLScheme])
    {
        NSNotification *notification = [NSNotification notificationWithName:kAFApplicationLaunchedWithURLNotification object:nil userInfo:[NSDictionary dictionaryWithObject:url forKey:kAFApplicationLaunchOptionsURLKey]];
        [[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.