WeChat Open Platform

Mobile SDK Documentation

Getting Started on iOS


1. Register an App ID

Fill in the required details on the App Registration page to obtain an App ID.

Submit the registered app for approval. Approved apps will be released.

2. Download the SDK package

The package is comprised of three files: libWeChatSDK.a, WXApi.h, and WXApiObject.h

Download SDK Package

3. Set up your development environment

  • Create a project in Xcode.

  • Add the following three files to your project: libWeChatSDK.a, WXApi.h, WXApiObject.h.

    • Note: For Xcode v4.3 and earlier, please use libWeChatSDK.a. For XCode v4.5 and later, use libWeChatSDK_armv7_v7s.a

      Xcode files

  • Edit the "Build Settings" for your project. Add the paths of the following files to "Search Paths", as shown below: libWeChatSDK.a, WXApi.h, WXApiObject.h. Xcode build path
  • In Xcode, select Targets > Info > URL type > URL scheme. Add the App ID you registered previously. For Xcode v3 and earlier, please add the ID to your plist file, as shown below: URL schemes in Xcode
  • Now you can start coding. For files on which you want to use the WeChat API, import WXApi.h and add the WXApiDelegate protocol:

          #import <UIKit/UIKit.h>
          #import "WXApi.h"
          @interface AppDelegate : UIResponder <UIApplicationDelegate, WXApiDelegate>
          @property (strong, nonatomic) UIWindow *window;
          @end
    

    You should implement - onReq:req and - onResp:resp: in these classes. To send a request to the API, call -sendReq: on the WXAPI class.