The First Face++ Objective-C Program

Please visit the Developers page and choose one of your application (or create one). In the application management page, download the IOS offline detector. Unzip the file, you will see,
  • FaceppLocalDetectorSDK: offline iOS detector, this is not for this article.
  • FaceppSDK: online Face++ API SDK.

Create a new Xcode iOS Project

1. In the menu bar, select File-->New-->Project.

2. Fill the name of your Xcode project. And then keep clicking "Next".

3. Pull FaceppSDK directory into the project. In addition, you should add one image for the purpose of testing. Please rename the image with "sample.jpg".

4.Add the following code into AppDelegate.m, method - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions,
[FaceppAPI initWithApiKey:@"YOUR_API_KEY" andApiSecret:@"YOUR_API_SECRET"
                                          andRegion:APIServerRegionCN];
[FaceppAPI setDebugMode:YES];

NSData *imageData = UIImageJPEGRepresentation(
    [UIImage imageNamed:@"sample.jpg"], 100);
FaceppResult *result = [[FaceppAPI detection] detectWithURL:nil
                        orImageData:imageData];

Notice: You should fill out @"YOUR_API_KEY" and @"YOUR_API_SECRET" with the given api_key and api_secret of your application in the Application Management System.

5. Run the program. You can see the detection results in the Console.
2013-10-31 16:43:48.288 FacePlusPlusDemo[2367:907] [FacePlusPlus]request url: 
https://apicn.faceplusplus.com/v2/detection/detect?api_key=xxx&api_secret=xxx&mode=normal&attribute=age,race,gender,smiling
2013-10-31 16:43:50.308 FacePlusPlusDemo[2367:907] [FacePlusPlus]response JSON:.......
6. For more detailed usage, please refer to the two Demos under the SDK directory.
Google+