• WeChat API Documentation


    BaseReq

    public

    Base class of all request classes of WeChat SDK.

    Import WXApiObject.h; BaseReq
    property
    (int) type
     
    int BaseReq::type

    Request type

    (NSString *) openID
     
    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

    public

    Base class of all response classes of WeChat SDK.

    Import WXApiObject.h; BaseResp
    property
    (int) errCode
     
    int BaseResp::errCode

    Error code

    (NSString *) errStr
     
    NSString* BaseResp::errStr

    Error notification string

    (int) type
     
    int BaseResp::type

    Response type

    GetMessageFromWXReq

    public

    Message structure that the third-party application uses to request authorization from WeChat.

    Import WXApiObject.h; GetMessageFromWXReq

    The third-party app requests for verification and authorization by calling sendReq member function of WXApi. WeChat will return a result after processing.

    GetMessageFromWXResp

    public

    Message structure that the third-party application uses to response requests from WeChat.

    Import WXApiObject.h; GetMessageFromWXResp

    WeChat sends a request to a third-party application; and the third-party application calls sendResp to return the result in a GetMessageFromWXResp message.

    property
    (NSString *) text
     
    NSString* GetMessageFromWXResp::text

    Text contents provided to WeChat

    (WXMediaMessage *) message
     
    WXMediaMessage* GetMessageFromWXResp::message

    Multi-media contents provided to WeChat

    (BOOL) bText
     
    BOOL GetMessageFromWXResp::bText

    Types of message that providing contents to WeChat. It could be text or multi-media but not both.

    LaunchFromWXReq

    public

    The message structure carried by WeChat client when a third-party application is opened.

    Import WXApiObject.h; LaunchFromWXReq

    This is the WeChat’s data structure sent to a third party. No return value expected from the third party.

    SendMessageToWXReq

    public

    Message structure that the third-party application uses to send message to WeChat.

    Import WXApiObject.h; SendMessageToWXReq

    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.

    property
    (NSString *) text
     
    NSString* SendMessageToWXReq::text

    Text contents in the message sent

    (WXMediaMessage *) message
     
    WXMediaMessage* SendMessageToWXReq::message

    Multi-media contents in the message sent

    (BOOL) bText
     
    BOOL SendMessageToWXReq::bText

    The message type can be Text or Multi-media but not both.

    (int) scene
     
    int SendMessageToWXReq::scene

    Target scene, you can send to contact or moments. Contact if default choice.

    SendMessageToWXResp

    public

    Result of SendMessageToWXReq that WeChat returns to the third-party app.

    Import WXApiObject.h; SendMessageToWXResp

    Wechat uses SendMessageToWXResp to return results of SendMessageToWXReq from the third-party app.

    ShowMessageFromWXReq

    public

    WeChat asks the third-party to show contents.

    Import WXApiObject.h; ShowMessageFromWXReq

    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.

    property
    (WXMediaMessage *) message
     
    WXMediaMessage* ShowMessageFromWXReq::message

    WeChat asks the third-party to show contents

    ShowMessageFromWXResp

    public

    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.

    Import WXApiObject.h; ShowMessageFromWXResp

    WXApi

    public

    WeChat API interface functions.

    Import WXApi.h; WXApi

    This class envelopes all interfaces of WeChat SDK

    function
    (BOOL) registerApp

    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.

    Params:
    appid   WeChat Developer ID  
    Returns:
    Yes (success) or No (failure)
    (BOOL) registerApp:withDescription

    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.

    Params:
    appid   WeChat developer ID  
    appdesc   Additional application description, no longer than 1024 bytes  
    Returns:
    Return ‘YES’ if success, otherwise return ‘NO’.
    (BOOL) handleOpenURL:delegate

    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

    Params:
    url   URL used to enable the app  
    delegate   Object of WXApiDelegate. It's used to receive messages that trigger WeChat  
    Returns:
    Yes (success) or No (failure)
    (BOOL) isWXAppInstalled

    Check whether the user has installed WeChat.

    BOOL WXApi::isWXAppInstalled ()

    Returns:

    Yes (WeChat installed) or No (WeChat not installed)
    (BOOL) isWXAppSupportApi

    Check whether the current WeChat version supports OpenApi.

    BOOL WXApi::isWXAppSupportApi ()

    Returns:

    Yes (support) or No (do not support)
    (NSString *) getApiVersion

    Get the current SDK version.

    NSString * WXApi::getApiVersion ()

    Returns:

    the current SDK version
    (NSString *) getWXAppInstallUrl

    Get installation URL of WeChat in iTunes.

    NSString * WXApi::getWXAppInstallUrl ()

    Returns:

    strings about installation URL of WeChat
    (BOOL) openWXApp

    Open WeChat.

    BOOL WXApi::openWXApp ()

    Returns:

    Yes (success) or No (failure)
    (BOOL) sendReq

    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.

    Params:
    req   Specific request. It should be auto-released after calling the function.  
    Returns:
    Yes (success) or No (failure)
    (BOOL) sendResp

    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.

    Params:
    resp   Specific response. It should be auto-released after calling the function.  
    Returns:
    Yes (success) or No (failure)

    WXAppExtendObject

    public

    App extend object included in multi-media messages.

    Import WXApiObject.h; WXAppExtendObject

    The third-party app sends a multi-media message that includes WXAppExtendObject to WeChat. WeChat calls this app to process the multi-media contents.

    property
    (NSString *) url
     
    NSString* WXAppExtendObject::url

    If the third-party app does not exist, WeChat will open the download URL of the app.

    (NSString *) extInfo
     
    NSString* WXAppExtendObject::extInfo

    Custom data of the third-party app. WeChat will return it to the app for processing.

    (NSData *) fileData
     
    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.

    function
    (WXAppExtendObject *) object

    Return a WXAppExtendObject object.

    WXAppExtendObject * WXAppExtendObject::object ()
     

    WXEmoticonObject

    public

    Emoticon object included in multi-media messages transferred between WeChat and the third-party app.

    Import WXApiObject.h; WXEmoticonObject

     

    property
    (NSData *) emoticonData
     
    NSData* WXEmoticonObject::emoticonData

    The content of emoticon

    function
    (WXEmoticonObject *) object

    Return a WXEmoticonObject object.

    WXEmoticonObject * WXEmoticonObject::object ()
     

    WXFileObject

    public

    todo

    Import WXApiObject.h; WXFileObject

     

    property
    (NSString *) fileExtension
     
    NSString* WXFileObject::fileExtension

    File Extensions

    (NSData *) fileData
     
    NSData* WXFileObject::fileData

    File content

    function
    (WXFileObject *) object

    Returns a WXFileObject object.

    WXFileObject * WXFileObject::object ()
     

    WXImageObject

    public

    Image object included in multi-media messages.

    Import WXApiObject.h; WXImageObject

    The image object included in the message transferred between WeChat and the third-party app

    property
    (NSData *) imageData
     
    NSData* WXImageObject::imageData

    Actual contents of the image

    (NSString *) imageUrl
     
    NSString* WXImageObject::imageUrl

    Image URL

    function
    (WXImageObject *) object

    Return a WXImageObject object.

    WXImageObject * WXImageObject::object ()
     

    WXMediaMessage

    public
    Import WXApiObject.h; WXMediaMessage

    Multi-media contents in the message sent

    property
    (NSString *) title
     
    NSString* WXMediaMessage::title

    Title

    (NSString *) description
     
    NSString* WXMediaMessage::description

    Description

    (NSData *) thumbData
     
    NSData* WXMediaMessage::thumbData

    Data of the thumb

    (NSString *) mediaTagName
     
    NSString* WXMediaMessage::mediaTagName

    todo

    (id) mediaObject
     
    id WXMediaMessage::mediaObject

    Multi-media data object, including WXWebpageObject, WXImageObject, WXMusicObject, etc.

    function
    (WXMediaMessage *) message
     
    WXMediaMessage * WXMediaMessage::message ()
     
    (void) setThumbImage

    Method used to set the thumb of image message.

    void WXMediaMessage::setThumbImage: (UIImage *image)
    Params:
    image   Thumb  

    WXMusicObject

    public

    Music object included in multi-media messages.

    Import WXApiObject.h; WXMusicObject

    Music object included in the message transferred between WeChat and the third-party app

    property
    (NSString *) musicUrl
     
    NSString* WXMusicObject::musicUrl

    URL of music webpage

    (NSString *) musicLowBandUrl
     
    NSString* WXMusicObject::musicLowBandUrl

    URL of music lowband webpage

    (NSString *) musicDataUrl
     
    NSString* WXMusicObject::musicDataUrl

    URL of music data

    (NSString *) musicLowBandDataUrl
     
    NSString* WXMusicObject::musicLowBandDataUrl

    URL of lowband data of the music

    function
    (WXMusicObject *) object

    Return a WXMusicObject object.

    WXMusicObject * WXMusicObject::object ()
     

    WXVideoObject

    public

    Video object included in multi-media messages.

    Import WXApiObject.h; WXVideoObject

    Video object included in the message transferred between WeChat and the third-party app

    property
    (NSString *) videoUrl
     
    NSString* WXVideoObject::videoUrl

    URL of video data

    (NSString *) videoLowBandUrl
     
    NSString* WXVideoObject::videoLowBandUrl

    URL of video lowband data

    function
    (WXVideoObject *) object

    Returns a WXVideoObject object.

    WXVideoObject * WXVideoObject::object ()
     

    WXWebpageObject

    public

    Webpage object included in multi-media messages.

    Import WXApiObject.h; WXWebpageObject

    Webpage object included in the multi-media message transferred between WeChat and the third-party app

    property
    (NSString *) webpageUrl
     
    NSString* WXWebpageObject::webpageUrl

    URL of the webpage

    function
    (WXWebpageObject *) object

    Return a WXWebpageObject object.

    WXWebpageObject * WXWebpageObject::object ()
     

    WXApiDelegate-p

    public

    Receive and process event messages from WeChat.

    Import WXApi.h; WXApiDelegate-p

    Receive and process event messages from WeChat. Meanwhile WeChat will switch to the third-party app. WXApiDelegate is used and triggered in handleOpenURL.

    function

    (void) onReq

    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.

    Params:
    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)  
  • 相关阅读:
    在oracle中通过connect by prior来实现递归查询!
    c# System.Data.OracleClient需要Oracle客户端软件8.1.7或更高版本
    c# 水晶报表的设计(非常的基础)
    webapi+EF(增删改查)
    简单三层分页aspnetpager控件(欢迎指点)
    listbox 多选删除(找了好多都不行,终于让我写出来了)
    execl导出(HTML,repearter控件)
    SQL Server中截取字符串常用函数
    几个经常用到的字符串的截取
    gridview的增删改
  • 原文地址:https://www.cnblogs.com/cai-rd/p/4333446.html
Copyright © 2020-2023  润新知