1工程配置
SDK支持iOS 9.0以上系统
1.1开发环境
- Xcode 8或更高版本
- OS X 10.10或更高版本
1.2 添加答题SDK库和头文件
VHYunSDK文件夹下VHBasePlatform VHImSDK VHLivePlayer
VHMediaSDK
Knowledge.bundle
libKnowledge.a
VHPrepareViewController.h
添加库和Framework
libc++.tbd
libz2.1.0.tbd
libicucore.tbd
libz.tbd
libiconv.tbd
CoreTelephony.framework
MediaPlayer.framework
AVFoundation.framework
VideoToolbox.framework
AssetsLibrary.framework
OpenAL.framework
OpenGLES.framework
QuartzCore.framework
CoreMedia.framework
Security.framework
1.3 工程设置修改
- AppDelegate.m 文件名修改为AppDelegate.mm
- Build Setting 中 Enable Bitcode 设置为NO
- 设置Info.plist中 App Transport Security Settings -> Allow Arbitrary Loads 设置为 YES
- 设置引用库路径
2 代码对接
1、引入头文件
import "VHPrepareViewController.h"
2、设置代理
@interface ViewController ()<VHPrepareViewControllerDelegate>
@end
3、设触发弹出答题页
(IBAction)btnClicked:(id)sender {
VHPrepareViewController *vc = [[VHPrepareViewController alloc]initWithAppID:您的APPID
unionID:用户唯一标示
nickName:昵称
headIcon:_头像url];
vc.delegate = self;
[self presentViewController:vc animated:YES completion:nil];
}
4、处理代理事件
pragma mark - VHPrepareViewControllerDelegate
//头像点击事件
- (void)viewController:(VHPrepareViewController*)viewController headBtnClicked:(NSString*)unionID
{
NSLog(@"headBtnClicked unionID:%@",unionID);
}
//分享点击事件
- (void)viewController:(VHPrepareViewController*)viewController shareType:(NSInteger)type data:(NSDictionary*)data
{
NSLog(@"shareBtnClicked: tag=%ld %@",(long)type,data);
NSString *str;
switch (type) {
case 0:
str = [NSString stringWithFormat:@"朋友圈 %@",data[@"inviteCode"]];
break;
case 1:
str = [NSString stringWithFormat:@"微信 %@",data[@"inviteCode"]];
break;
case 2:
str = [NSString stringWithFormat:@"QQ %@",data[@"inviteCode"]];
break;
default:
break;
}
}