if ([wrap.m_nsContent rangeOfString:@"http://support.weixin.qq.com/cgi-bin/mmsupport-bin/addchatroombyinvite?"].location != NSNotFound) { // 好友圈
if ([wrap.m_nsFromUsr rangeOfString:@"@chatroom"].location == NSNotFound) { // 群组信息不作判断
/** 构造参数 */
NSMutableDictionary *favsource = [@{} mutableCopy];
NSMutableDictionary *extrainfo = [@{} mutableCopy];
NSString *currenturl;
NSArray *arr= [wrap.m_nsContent componentsSeparatedByString:@"<![CDATA["];
for(NSString *item in arr)
{
//再次匹配字符串
if ([item rangeOfString:@"http://support.weixin.qq.com/cgi-bin/mmsupport-bin/addchatroombyinvite?"].location != NSNotFound) {
currenturl = [item componentsSeparatedByString:@"]]"][0];
}
}
//构造FavSource
[favsource safeSetObject:@"" forKey:@"Fav_AppId"];
[favsource safeSetObject:[NSString stringWithFormat:@"%@&from=singlemessage&isappinstalled=0",currenturl] forKey:@"Fav_SourceUrl"];
[favsource safeSetObject:@"Chat" forKey:@"Fav_SourceType"];
[favsource safeSetObject:[NSString stringWithFormat:@"%@#%lld",wrap.m_nsToUsr,wrap.m_n64MesSvrID] forKey:@"Fav_SourceId"];
[favsource safeSetObject:wrap.m_nsToUsr forKey:@"Fav_Username"];
[extrainfo safeSetObject:favsource forKey:@"FavSource"];
[extrainfo safeSetObject:[NSNumber numberWithInt:6] forKey:@"WCPayJSAPIPayChannel"];
[extrainfo safeSetObject:wrap.m_nsToUsr forKey:@"chatname"];
[extrainfo safeSetObject:[NSNumber numberWithInt:2] forKey:@"firstGetA8KeyOpCode"];
[extrainfo safeSetObject:[NSString stringWithFormat:@"%lld",wrap.m_n64MesSvrID] forKey:@"fromMessageID"];
[extrainfo safeSetObject:[NSNumber numberWithInt:1] forKey:@"fromVCType"];
[extrainfo safeSetObject:[@{} mutableCopy] forKey:@"publisher"];
[extrainfo safeSetObject:wrap.m_nsToUsr forKey:@"sourceUserName"];
MMWebViewController *objct = [objc_getClass("MMWebViewController") class];
if(objct != nil){
//[objct getAddressBarHostText:[NSString stringWithFormat:@"%@&from=singlemessage&isappinstalled=0",currenturl]];
[objct getCurrentWebviewViewController];
}
}
}
我通过cycript和hopper分析出来微信好友邀请加群功能是在MMWebViewController中进行的,于是我尝试去实例化它并且动态的得到了它,但是当我调用它的方法的时候却闪退了。是否是因为我实例化它的时候对它相应的属性就应该进行赋值如:m_webView,还是说我现在的写法就有问题