Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5732

求助~新华字典 app 每天免费查询问题?

$
0
0

@HomlesZhao wrote:

新华字典:joy:, 每天免费查询两次, 我试过删除重新安装 app 就可以获取两次免费查询....我猜想可能是:

  • 用 NSUserDefaults 保存在了本地, 我在基类 UIViewController 的 viewwillappear 方法中将 NSUserDefaults 有关这个 app 的所有内容清空, 经测试, 清空成功, 因为每次开启都会有引导页出现, 但是无法继续免费查询
  • 因为删除重装就可以免费查询, 有可能是 devicetoken 问题, 比如说给服务器上传这个值, 服务器判断是不是同一部手机;代码如下, 经测试还是不能免费查询:

CHDeclareClass(AppDelegate)

CHOptimizedMethod2(self, void, AppDelegate, application, UIApplication *, arg1, didRegisterForRemoteNotificationsWithDeviceToken, NSData *, arg2) {
    NSString*newToken =@"72ff63cea198b3edba8f7e0c23acc345050187a0cde5a9872cbab091ab73e553";
    
    NSMutableData *apnsTokenMutableData = [[NSMutableData alloc]init];
    
    unsigned char whole_byte;
    
    char byte_chars[3] = {'\0','\0','\0'};
    
    int i;
    
    for(i=0; i < [newToken length]/2; i++) {
        
        byte_chars[0] = [newToken characterAtIndex:i*2];
        
        byte_chars[1] = [newToken characterAtIndex:i*2+1];
        
        whole_byte =strtol(byte_chars,NULL,16);
        
        [apnsTokenMutableData appendBytes:&whole_byte length:1];
        
    }
    
    NSData *apnsTokenData = [NSData dataWithData:apnsTokenMutableData];
    arg2 = apnsTokenData;
    CHSuper2(AppDelegate, application, arg1, didRegisterForRemoteNotificationsWithDeviceToken, arg2);
}

求助: 还有没有别的什么思路?

Posts: 13

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 5732

Trending Articles