Integration of huanxin SDK and Apple Watch (1), sdkapple
This series is recorded in the Development of IM on apple watch, using the recently popular im sdk.
I. First, let's take a look at the information that can be found everywhere on the Internet:
1. Two resolutions
1.65 inch 312*390
1.5 inch 272*340
2. Development Environment
Xcode 6.2 or later
OS X 10.9.4 or later
Watchkit
3. Three display types
A> the standard watch app has its own interface and functions
B> Glances, pure information browsing, and fixed style. This method is suitable for news, weather, stocks, sports data, and other information.
C> Notification, used to display local and remote notifications of users. It can be Short-Look or Long-Look.
4. Official documents
Https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/index.html
5. How to add apple watch to the Project
There are a lot of materials on the Internet, and there are some good blogs on this external link:
Http://www.tuicool.com/articles/MFJFNny
Http://www.open-open.com/lib/view/open1421896724640.html
Ii. Combination of WatchKit and the huanxin SDK
1. Add the WatchKit extension to the project.
You can create a new project, add it on the target, or add it on the target of an existing project. The operation steps are the same.
To ensure the integrity of the record, I created a new project EMWatchOCDemo. You can see it by name. This is a project written by ObjC.
2. EMWatchOCDemo is an iphone program. It first accesses the ring information SDK on this target.
Follow the ios integration documentation on the official website to download the sdk, add the dependent library, and configure the attributes. I don't want to implement real-time speech, so I only use lite.. The project after importing the huanxin sdk looks like this
I prefer to compile each step. If the compilation is successful, continue with the following steps.
3. initialize the huanxin SDK
The SDK Initialization is almost all in AppDelegate. m implementation, such as registering an app, configuring an apns certificate and nickname, and entering the foreground and background operations. These operations are described in the ios initialization documentation on the official website of www.huanxin.
4. implement some simple functions
ConversationViewController obtains and displays sessions.
Obtain and display friends of FriendsViewController.
Obtain and display the GroupsViewController group.
HomeViewController is the home page and Tab container, which enables login and other operations.
DXEMIMHelper is the management class of IM and defines a Global Macro, including the default Logon account KDEFAULT_USERNAME.