Xamarin.iOS私有API LSApplicationWorkspace

时间:2018-01-03 12:34:59

标签: xamarin xamarin.ios

如何在Xamarin.iOS项目中使用以下代码或如何在Xamarin C#中使用iOS私有API?最好的问候。

Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject * workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
BOOL isopen = [workspace performSelector:@selector(openApplicationWithBundleID:) withObject:@"com.apple.mobilesafari"];

1 个答案:

答案 0 :(得分:0)

试试这个:

NSObject LSApplicationWorkspace_class = new NSObject(Class.GetHandle("LSApplicationWorkspace"));
NSObject workspace = LSApplicationWorkspace_class.PerformSelector(new Selector("defaultWorkspace"));
var isOpen = workspace.PerformSelector(new Selector("openApplicationWithBundleID:"), new NSString("com.apple.mobilesafari"));