iOS SDK wrapping OneAll REST API
Objective-C C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

SDK for using OneAll on iOS in order to allow users to login with 30+ social networks and make posts on their walls.

  • Login using OneAll authentication using UIWebView (30+ Social Networks supported)
  • Login using OneAll by using the native Facebook or Twitter SDKs (iOS6 and later)
  • Post on the user's social networks accounts

Setting up XCode Project

Add the OneAll SDK to your project

Using Finder drag the OneAll.xcodeproj file into the XCode and place in your project:

XCode Setup

Setup Header Paths

Now select your project in project explorer and click “Build Settings”:

Build Settings

Make sure your target is selected on the left of the panel, then find “Header Search Paths” in the list of settings and add the folder in which the OneAll library is located. This would normally be the folder from which you dragged the OneAll.xcodeproj from:

Header Search Paths

Link the Library

Now, go into “Build Phases”, expand “Link Binary With Libraries” section and click “+” in this section. Add the libOneAll.a from the top of the list:

Link Library

Add Resources

While at the same screen, make sure the resources of the library are added to the final executable by dragging it from the project explorer into “Copy Bundle Resources” section:


Setup Source Files

Import the SDK main include file at the top of AppDelegate.m:

#import <OneAll/OneAll.h>

In your AppDelegate.m file, in application:didFinishLaunchingWithOptions: add the following initialization code:

- (BOOL)application:(UIApplication *)application
     didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
     [[OAManager sharedInstance] setupWithSubdomain:@"foo"];

Of course, replace "foo" with your own OneAll application subdomain.

Add a button on one of the forms and create an action for it in corresponding controller. In this handler add the following code:

[[OAManager sharedInstance] loginWithSuccess:^(OAUser *user) {
    NSLog(@"User logged in: %@", user);
                                  andFailure:^(NSError *error) {
    NSLog(@"Failed to login user: %@, %@", error.localizedDescription, error.userInfo);

You are all set! Running the project and tapping the new button you should see the login screen with all possible providers selection.

Build Settings

If you receive an error like for example Unrecognized selector sent to class 0x1ada5dae8 when trying to login with a social network, then please add the -ObjC flag (note the captial C) in the build settings under Other Linker Flags. This must be set in the linker settings for the target using the library, not in the library itself.



Login Using Own Provider Selector

Instead of using SDK’s own login screen you may design your own selector of provider types. In order to login using specific provider, use the following call (with Reddit authentication):

[[OAManager sharedInstance] loginWithProvider:OA_PROVIDER_REDDIT
                                      success:^{ NSLog(@”Login succeeded”); }
                                      failure:^{ NSLog(@”Login failed”); }];

This will allow you to fully customise the appearance of the login window and just call the library to do an actual authentication.

Controlling Network Activity Indicator

Generally, network activity indicator should be controlled by the application. If the application does not use, it may transfer the control of the indicator to the library by calling

[[OAManager sharedInstance] setNetworkActivityIndicatorControlledByOa:true];

The indicator will be activated whenever the SDK is communicating with servers.


Setting up Native Twitter Auth

To use native Twitter Authentication, you have to setup the library with more settings. Replace the initialisation with the following call:

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    [[OAManager sharedInstance] setupWithSubdomain:@"foo"

Of course, replace twitter_consumer_key and twitter_secret with values from your Twitter application settings ( Now when trying to login, the SDK will attempt to login using native iOS Twitter authentication and if unavailable, fall back to regular web based login.

Setting up Native Facebook Auth

First setup, your Facebook application according to Facebook’s Getting Started tutorial: Pay attention that you add your Facebook.framework To use native Twitter Authentication, you have to pass Facebook application ID to the initialisation code:

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    [[OAManager sharedInstance] setupWithSubdomain:@"foo"

Of course, replace the facebook id parameter with AppID of your Facebook app ( Make sure URL’s are handled by the SDK too. Override application:openURL:sourceApplication: and inform the manager about URL opening:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
    return [[OAManager sharedInstance] handleOpenUrl:url sourceApplication:sourceApplication];

In addition, take care of application returning from background by overriding applicationDidBecomeActive.

- (void)applicationDidBecomeActive:(UIApplication *)application
    [[OAManager sharedInstance] didBecomeActive];

Now when trying to login, the SDK will attempt to login using Facebook SDK using installed Facebook application and if unavailable, fall back to regular web based login.

Posting Message to User’s Wall

The SDK allows to post messages to user wall according to this guide: in order to make the post, OAManager exposes the following:

[[OAManager sharedInstance] postMessageWithText:@”Lorem Ipsum”
                 pictureUrl:[NSURL URLWithString:@””
                    linkUrl:[NSURL URLWithString:@””]
                   callback:^(BOOL failed, OAMessagePostResult *result, OAError *error) {
                       NSLog(@”Message posted with status: %d”, (int)failed);


The sample project (but not the SDK) includes Facebook SDK which is distributed under Apache MIT licese

@urk OneAll