最后更新于:2019-06-28
目录结构
接口文件 ucCalendarSDK.framework/Headers/ucCalendarSDK.h
1. 允许应⽤通讯
打开 plist ⽂件 增加 key
2. 配置应用白名单
打开 plist ⽂件 增加 key
baidumap 百度地图功能相关 quanshi wxba6700a6453c7db6
3. 注册 url schema
打开 plist ⽂文件 增加 key
4. 允许获取 GPS 信息
打开 plist ⽂件 增加 key: NSLocationWhenInUseUsageDescription
5. 允许 Bitcode
Setting -> Build Settings
6. 添加日程依赖库
7. 百度地图功能相关
Setting -> Build Phases
1.初始化UCCalendarConfig
#import <ucCalendarSDK/ucCalendarSDK.h>
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *logDirectory = [documentsDirectory
stringByAppendingString:@"/log/ucCalendarSDK"];
UCCalendarConfig *config = [[UCCalendarConfig alloc]init]; // BAIDU_KEY 是与 app bundle id 相匹配的 key, config.baiduKey = BAIDU_KEY;
// ⽇志目录
config.logFolder = logDirectory;
// 设置值为注册的 url schema
config.appSchema = APP_SCHEMA;//@"ucmobileTest"
// ⽤用于识别吊起 app 的⽬的,此处⽤于加入全时云会议
config.appUrl = APP_URL;//@"com.quanshi.ucmobile" config.writeSystemEvent = YES;//是否把会议事件写入到App的⽇历中 [[ucCalendarSDK sharedInstance] initWithConfig:config];
2.设置delegate
当token过期时需要处理理
@protocol UCCalendarUserStatusDelegate<NSObject>
- (void)onAccountInvalid:(NSString *)account token:(NSString *)token;
@end
[[ucCalendarSDK sharedInstance] setUserStatusDelegate:self];
3. 调⽤登录接⼝
[[ucCalendarSDK sharedInstance] login:accountInfo.userId
token:accountInfo.token completionBlock:^(BOOL bSuccess, NSError *error)
{
dispatch_async(dispatch_get_main_queue(), ^{
if (bSuccess)
{
//Need TODO
}
else if (error.code == ERR_UC_ACCOUNT_LOGIN_HIGN_FREQUENCY)
{
//Need TODO
}else {
//Need TODO
}
});
}];
4. 设置入会电话
-(void)setPhoneNumber:(NSString *)phoneNumber;
5. 显示日程主界⾯面
注意:原 view 须带导航栏
UIViewController<UCTransitionDelegateWrap> *vc = [[ucCalendarSDK
sharedInstance] instantiatePrimaryViewController];
[self.navigationController pushViewController:vc animated:YES];
6. 显示安排日程界⾯面
注意:原 view 须带导航栏
UIViewController<UCTransitionDelegateWrap> *vc = [[ucCalendarSDK
sharedInstance] instantiateArrangeViewControllerWithParticipants:[NSArray
arrayWithObjects:@"5841", @"63720562", nil]];
[self.navigationController pushViewController:vc animated:YES];
7. 从系统日历中点击入全时云会议
从 url 中解析出 eventId, 调用 sdk 接口 joinConf
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSString *scheme = [url scheme];
// 在config 传入的 schema
if ([scheme isEqualToString:APP_SCHEMA])
{
NSRange range = [[url relativeString] rangeOfString:APP_URL];
if (range.location != NSNotFound){
NSString *eventId =[[url relativeString]substringFromIndex:
(range.location+range.length)];
if (eventId && eventId.integerValue> 0){
dispatch_async(dispatch_get_global_queue(0, 0), ^(void) {
[[ucCalendarSDK sharedInstance] joinConf:eventId completionBlock:^(BOOL bSuccess, NSError *error) {
if (!bSuccess)
{
}
}];
});
}
}
return YES;
}
8. 传参 eventId
进入会议详情
[[ucCalendarSDK sharedInstance] instantiateEventJoinViewController:eventId
block:^(BOOL bSuccess, UIViewController *vc, NSString *errInfo) {
if (bSuccess && vc)
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController pushViewController:vc animated:YES];
});
}
else{
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"alert"
message:errInfo delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
};
}];
9. ⽴即起会
传参:confId, confPwd, username
[[ucCalendarSDK sharedInstance] joinConfImmediately:confId
confPwd:confPwd userName:userName block:^(BOOL bSuccess, NSString
*errInfo) {
}];
10. 上传⽇志到全时Server
描述信息,可以为Null
-(void)uploadLogsWithDescription:(NSString *)description completion:(void
(^)(BOOL finished, NSError *error))completion;
11. 初始化 WIKI空间主页⾯
UIViewController *vc = [[ucCalendarSDK sharedInstance]
instantiateWikiListViewController];
[self.navigationController pushViewController:vc animated:YES];
12. 初始化 Task 任务主⻚⾯
UIViewController *vc = [[ucCalendarSDK sharedInstance]
instantiateTaskViewController];
[self.navigationController pushViewController:vc animated:YES];
1.App方向设置
配置target⽀持 UIInterfaceOrientationMaskAllButUpsideDown,如果不希望⽀持多方向,请在 您的delegate⽂件中实现
(UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskPortrait;
}