Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios微信分享取消后回调返回值问题 #15

Open
3dseals opened this issue Sep 12, 2018 · 3 comments
Open

ios微信分享取消后回调返回值问题 #15

3dseals opened this issue Sep 12, 2018 · 3 comments

Comments

@3dseals
Copy link

3dseals commented Sep 12, 2018

我在用最新的libWeChatSDK时发现分享后返回的回调值始终是成功

请问我如何判断用户取消了分享还是真的分享出去了呢

因为这个逻辑涉及到我们游戏里面是否给用户发放奖励

以下是我回调时使用的代码,而取消和成功时messageResp.errCode始终是0

-(void) onResp:(BaseResp*)resp{
    NSLog(@"wx resp data code:%d  str:%@",resp.errCode,resp.errStr);
    if ([resp isKindOfClass:[SendMessageToWXResp class]]) {
        SendMessageToWXResp *messageResp = (SendMessageToWXResp *)resp;
        int result = 0;
        NSString* userId = NULL;
        if(__wxTransactionUserId && [__wxTransactionUserId isKindOfClass:[NSString class]] && [__wxTransactionUserId hasPrefix:@"userId="]){
            userId = [__wxTransactionUserId substringFromIndex:7];
        }
        if (messageResp.errCode== 0) {
            result = 1;
        }else if (messageResp.errCode== -2) {

            //取消不会走这里?
        }else {
        }
        if(userId){
            char tmp[255]= {0};
            const char* tcode = [userId UTF8String];
            sprintf(tmp, "app.weChat.onShareResp('%s', %d)",tcode,result);
            se::ScriptEngine::getInstance()->evalString(tmp);
        }
    }
    __isWxLogin = false;
}

@CupidLoud
Copy link

二楼正解

@hw20101101
Copy link

请问为什么我的项目不走微信的代理方法呢?我是按照微信开放平台的文档操作的(微信分享)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants