Ios 如何以编程方式检查iPhone中的3D触控功能?

Ios 如何以编程方式检查iPhone中的3D触控功能?,ios,objective-c,iphone,xcode,3dtouch,Ios,Objective C,Iphone,Xcode,3dtouch,我有我的ios应用程序,我想检查3D touch的可用性意味着什么(iPhone 6s或iPhone 6s plus) 那我怎么检查呢?你应该试试这个 //check if the device supports 3DTouch if(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable){ [self registerForPreviewingWithDelegate:self sour

我有我的ios应用程序,我想检查3D touch的可用性意味着什么(iPhone 6s或iPhone 6s plus)

那我怎么检查呢?

你应该试试这个

//check if the device supports 3DTouch
if(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable){
    [self registerForPreviewingWithDelegate:self sourceView:self.view];
}else{
    [[[UIAlertView alloc] initWithTitle:@"Error" message:@"3DTouch not available" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
}

你能给我这个重复问题的链接吗???