BaseReq
publicBase class of all request classes of WeChat SDK.
Import WXApiObject.h;
int BaseReq::type
Request type
NSString* BaseReq::openID
The unique identifier, comprised of a user’s WeChat ID and App ID, must be filled by developers while sending a request. The purpose is to check whether the user has logged in with another account.
BaseResp
publicBase class of all response classes of WeChat SDK.
Import WXApiObject.h;
int BaseResp::errCode
Error code
NSString* BaseResp::errStr
Error notification string
int BaseResp::type
Response type
GetMessageFromWXReq
publicMessage structure that the third-party application uses to request authorization from WeChat.
Import WXApiObject.h;
The third-party app requests for verification and authorization by calling sendReq member function of WXApi. WeChat will return a result after processing.
GetMessageFromWXResp
publicMessage structure that the third-party application uses to response requests from WeChat.
Import WXApiObject.h;
WeChat sends a request to a third-party application; and the third-party application calls sendResp to return the result in a GetMessageFromWXResp message.
NSString* GetMessageFromWXResp::text
Text contents provided to WeChat
WXMediaMessage* GetMessageFromWXResp::message
Multi-media contents provided to WeChat
BOOL GetMessageFromWXResp::bText
Types of message that providing contents to WeChat. It could be text or multi-media but not both.
LaunchFromWXReq
publicThe message structure carried by WeChat client when a third-party application is opened.
Import WXApiObject.h;
This is the WeChat’s data structure sent to a third party. No return value expected from the third party.
SendMessageToWXReq
publicMessage structure that the third-party application uses to send message to WeChat.
Import WXApiObject.h;
The third-party app uses SendMessageToWXReq to send messages to WeChat. The message type can be text (member: text) and multi-media (member: message). WeChat will then return the result after processing.
NSString* SendMessageToWXReq::text
Text contents in the message sent
WXMediaMessage* SendMessageToWXReq::message
Multi-media contents in the message sent
BOOL SendMessageToWXReq::bText
The message type can be Text or Multi-media but not both.
int SendMessageToWXReq::scene
Target scene, you can send to contact or moments. Contact if default choice.
SendMessageToWXResp
publicResult of SendMessageToWXReq that WeChat returns to the third-party app.
Import WXApiObject.h;
Wechat uses SendMessageToWXResp to return results of SendMessageToWXReq from the third-party app.
ShowMessageFromWXReq
publicWeChat asks the third-party to show contents.
Import WXApiObject.h;
WeChat sends an ShowMessageFromWXReq message to ask the third-party app to show certain contents. And the third-party app calls sendResp to send an ShowMessageFromWXResp message to WeChat after processing.
WXMediaMessage* ShowMessageFromWXReq::message
WeChat asks the third-party to show contents
ShowMessageFromWXResp
publicWeChat sends an ShowMessageFromWXReq message to ask the third-party app to show certain contents. And the third-party app calls sendResp to send an ShowMessageFromWXResp message to WeChat after processing.
Import WXApiObject.h;
WXApi
publicWeChat API interface functions.
Import WXApi.h;
This class envelopes all interfaces of WeChat SDK
Member function of WXApi. It's used to register the third-party app in WeChat.
BOOL WXApi::registerApp: (NSString *appid)
It should be called whenever WeChat enables the third-party app. The app will appear in Available Apps in WeChat.
appid | WeChat Developer ID |
A member function of WXApi, used for the application registration of third parties in WeChat client program.
BOOL WXApi::registerApp:withDescription: (NSString *appid,[withDescription] NSString *appdesc)
Needs to be called when a third-party application starts each time. It will show in the list of available applications on WeChat after the first call.
appid | WeChat developer ID | ||
appdesc | Additional application description, no longer than 1024 bytes |
Process the data transferred while WeChat enable the app through URL.
BOOL WXApi::handleOpenURL:delegate: (NSURL *url,[delegate] id< WXApiDelegate > delegate)
Call in application:openURL:sourceApplication:annotation: or application:handleOpenURL
url | URL used to enable the app | ||
delegate | Object of WXApiDelegate. It's used to receive messages that trigger WeChat |
Check whether the user has installed WeChat.
BOOL WXApi::isWXAppInstalled ()
Returns:
Check whether the current WeChat version supports OpenApi.
BOOL WXApi::isWXAppSupportApi ()
Returns:
Get the current SDK version.
NSString * WXApi::getApiVersion ()
Returns:
Get installation URL of WeChat in iTunes.
NSString * WXApi::getWXAppInstallUrl ()
Returns:
Open WeChat.
BOOL WXApi::openWXApp ()
Returns:
Send a request to WeChat and wait for onResp returned from WeChat.
BOOL WXApi::sendReq: (BaseReq *req)
The third-party app calls this function, switches to WeChat interface and waits for onResp returned from WeChat. WeChat must calls onResp after the asynchronous processing. Possible requests include SendMessageToWXReq, etc.
req | Specific request. It should be auto-released after calling the function. |
Send the response of onReq request from WeChat and go to WeChat interface.
BOOL WXApi::sendResp: (BaseResp *resp)
When this function is called, WeChat interface is open. The third-party app receives onResp request from WeChat, processes this request asynchronously and calls this function. Possible requests include GetMessageFromWXResp, ShowMessageFromWXResp, etc.
resp | Specific response. It should be auto-released after calling the function. |
WXAppExtendObject
publicApp extend object included in multi-media messages.
Import WXApiObject.h;
The third-party app sends a multi-media message that includes WXAppExtendObject to WeChat. WeChat calls this app to process the multi-media contents.
NSString* WXAppExtendObject::url
If the third-party app does not exist, WeChat will open the download URL of the app.
NSString* WXAppExtendObject::extInfo
Custom data of the third-party app. WeChat will return it to the app for processing.
NSData* WXAppExtendObject::fileData
App file data. When this data is sent to WeChat contacts, the contact needs to click to download. WeChat then returns it to the app for processing.
Return a WXAppExtendObject object.
WXAppExtendObject * WXAppExtendObject::object ()
WXEmoticonObject
publicEmoticon object included in multi-media messages transferred between WeChat and the third-party app.
Import WXApiObject.h;
NSData* WXEmoticonObject::emoticonData
The content of emoticon
Return a WXEmoticonObject object.
WXEmoticonObject * WXEmoticonObject::object ()
WXFileObject
publictodo
Import WXApiObject.h;
NSString* WXFileObject::fileExtension
File Extensions
NSData* WXFileObject::fileData
File content
WXImageObject
publicImage object included in multi-media messages.
Import WXApiObject.h;
The image object included in the message transferred between WeChat and the third-party app
NSData* WXImageObject::imageData
Actual contents of the image
NSString* WXImageObject::imageUrl
Image URL
WXMediaMessage
publicImport WXApiObject.h;
Multi-media contents in the message sent
NSString* WXMediaMessage::title
Title
NSString* WXMediaMessage::description
Description
NSData* WXMediaMessage::thumbData
Data of the thumb
NSString* WXMediaMessage::mediaTagName
todo
id WXMediaMessage::mediaObject
Multi-media data object, including WXWebpageObject, WXImageObject, WXMusicObject, etc.
WXMediaMessage * WXMediaMessage::message ()
Method used to set the thumb of image message.
void WXMediaMessage::setThumbImage: (UIImage *image)
image | Thumb |
WXMusicObject
publicMusic object included in multi-media messages.
Import WXApiObject.h;
Music object included in the message transferred between WeChat and the third-party app
NSString* WXMusicObject::musicUrl
URL of music webpage
NSString* WXMusicObject::musicLowBandUrl
URL of music lowband webpage
NSString* WXMusicObject::musicDataUrl
URL of music data
NSString* WXMusicObject::musicLowBandDataUrl
URL of lowband data of the music
WXVideoObject
publicVideo object included in multi-media messages.
Import WXApiObject.h;
Video object included in the message transferred between WeChat and the third-party app
NSString* WXVideoObject::videoUrl
URL of video data
NSString* WXVideoObject::videoLowBandUrl
URL of video lowband data
WXWebpageObject
publicWebpage object included in multi-media messages.
Import WXApiObject.h;
Webpage object included in the multi-media message transferred between WeChat and the third-party app
NSString* WXWebpageObject::webpageUrl
URL of the webpage
Return a WXWebpageObject object.
WXWebpageObject * WXWebpageObject::object ()
WXApiDelegate-p
public
Receive and process event messages from WeChat.
Import WXApi.h;
Receive and process event messages from WeChat. Meanwhile WeChat will switch to the third-party app. WXApiDelegate is used and triggered in handleOpenURL.
function
Receive and process request from WeChat and call sendResp.
void WXApiDelegate-p::onReq: (BaseReq *req)
The third-party app receives a request from WeChat. After asynchronous processing of the request. sendResp should be called to send the result to WeChat. Possible requests include GetMessageFromWXReq, ShowMessageFromWXReq, etc.
req | Specific request contents (auto-released) |
(void) onResp
Response of sendReq from WeChat.
void WXApiDelegate-p::onResp: (BaseResp *resp)
The third-party app receives the result from WeChat. If sendReq is called, onResp will be received. Possible results include SendMessageToWXResp, etc.
Params:
Specific | response contents (auto-released) |