extern "C"
{
// 对Unity中的unityToIOS方法进行实现
void unityToIOS(char* str){
// Unity传递过来的参数
NSLog(@"%s",str);
// UnityPause(true);
// 跳转到IOS界面,Unity界面暂停
// [LARManager sharedInstance].unityIsPaused = YES;
// GetAppController()获取appController,相当于self
// UnityGetGLView()获取UnityView,相当于_window
// NSString *text = @"自定义Activity";
// UIImage *image = [UIImage imageNamed:@"icon"];
// NSURL *url = [NSURL URLWithString:@"https://www.jianshu.com/u/d07fe467cee6"];
// NSArray *activityItems = @[url,text,image];
NSURL*urlToShare= [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video0" ofType:@"mp4"]];
NSArray *activityItems = @[urlToShare];
//创建分享视图控制器
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
// UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[@"video0.mp4", [[NSBundle mainBundle] URLForResource:@"video0" withExtension:@"mp4"]] applicationActivities:nil];
//关闭系统的一些activity类型
activityVC.excludedActivityTypes = @[];
//在展现view controller时,必须根据当前的设备类型,使用适当的方法。在iPad上,必须通过popover来展现view controller。在iPhone和iPodtouch上,必须以模态的方式展现。
[GetAppController().window.rootViewController presentViewController:activityVC animated:YES completion:nil];
}
}
网友评论