Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UITraitCollection getter,iOS13不支持它_Ios_Swift_Xcode - Fatal编程技术网

UITraitCollection getter,iOS13不支持它

UITraitCollection getter,iOS13不支持它,ios,swift,xcode,Ios,Swift,Xcode,我正在尝试更新iOS13的项目。我正在我的应用程序项目中使用库 我将此库放在UIViewController中,如下所示。我将自定义视图放在数据源中 -(TTSlidingPage*)页面滑动页面可视控制器:(TTScrollSlidingPagesController\u Custom*)源索引:(int)索引{ PhotoGalleryItemView*项=[[PhotoGalleryItemView alloc]initPhotoGalleryItem:[restaurantData.Ga

我正在尝试更新iOS13的项目。我正在我的应用程序项目中使用库

我将此库放在UIViewController中,如下所示。我将自定义视图放在数据源中

-(TTSlidingPage*)页面滑动页面可视控制器:(TTScrollSlidingPagesController\u Custom*)源索引:(int)索引{
PhotoGalleryItemView*项=[[PhotoGalleryItemView alloc]initPhotoGalleryItem:[restaurantData.Galeri objectAtIndex:index]ParentViewController:self];
item.view.frame=\u ViewPhotoContainer.frame;
TTSlidingPage*slidingPage=[[TTSlidingPage alloc]initWithContentViewController:item];
返回滑动页面;
}
但当我运行应用程序时,它会崩溃,尽管我使用DispatchQueue Main Async重新加载了数据

之后,我运行我的应用程序it崩溃,出现以下错误:

2019-11-08 10:03:40.570894+0300 GastroClub[5914:42170] [TraitCollection] Class PhotoGalleryItemView overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
2019-11-08 10:03:40.571987+0300 GastroClub[5914:42170] [Assert] Current fallback trait collection contains one or more unspecified traits: {(
    "_UITraitNameDisplayGamut",
    "_UITraitNameDebugHighlight",
    "_UITraitNameDisplayScale",
    "_UITraitNameDisplayCornerRadius",
    "_UITraitNamePresentationSemanticContext",
    "_UITraitNameUserInterfaceLevel",
    "_UITraitNameVibrancy",
    "_UITraitNameLegibilityWeight",
    "_UITraitNamePreferredContentSizeCategory",
    "_UITraitNameAccessibilityContrast",
    "_UITraitNameTouchLevel",
    "_UITraitNameSemanticContext"
)}; traitCollection: <UITraitCollection: 0x600001984600; >; currentFallbackEnvironment: <PhotoGalleryItemView: 0x7fdeb1e9cac0>
2019-11-08 10:03:40.570894+0300 GastClub[5914:42170][TraitCollection]类PhotoGalleryItemView覆盖-TraitCollection getter,这是不受支持的。如果您试图覆盖traits,则必须使用适当的API。
2019-11-08 10:03:40.571987+0300 GastroClub[5914:42170][Assert]当前回退特征集合包含一个或多个未指定特征:{(
“\u UITraitNameDisplayGamut”,
“_UITraitNameDebugHighlight”,
“\u UITraitNameDisplayScale”,
“\u uitraitnamedingcornerRadius”,
“\u UITraitNamePresentationSemanticContext”,
“\u UITraitNameUserInterfaceLevel”,
“_uitraitnamerivibrance”,
“\u uitraitnameibilityweight”,
“\u UITraitNamePreferredContentSizeCategory”,
“\u UITraitNameAccessibilityContrast”,
“\u UITraitNameTouchLevel”,
“\u UITraitNameSemanticContext”
)}; traitCollection:;currentFallbackEnvironment:

我如何解决这个问题?我无法更新我的库,因为它不再处于活动开发中

我找到了解决办法。当我启动滑动页面时,我会显示一个预加载程序。我的崩溃发生在我显示预加载程序时。当我将预加载程序放入DispatchAsyncAfter(如下所示)时,我可以修复我的错误:

dispatch\u after(dispatch\u time(dispatch\u time\u NOW,0.5*NSEC\u/秒),dispatch\u get\u main\u queue()^{
[自动添加预订单];
__弱类型(自我)弱自我=自我;
[self-sd_setImageWithURL:url
占位符图像:占位符
选项:选项
进度:progressBlock
已完成:^(UIImage*image,NSError*error,SDImageCacheType cacheType,NSURL*imageUrl){
if(完成块){
completedBlock(图像、错误、缓存类型、图像URL);
}
dispatch\u async(dispatch\u get\u main\u queue(),^(void){
if(弱自我预编码){
dispatch\u async(dispatch\u get\u main\u queue(),^(void){
[weakSelf.preoding stop animating];
[weakSelf.preoding removeFromSuperview];
[weakSelf removeActivityIndicator];
});
}
});
}
];
});

在swift 5中,它适合我

DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(0.5 * Double(NSEC_PER_SEC)) / Double(NSEC_PER_SEC), execute: {

    // your code here

 })

在我们的项目中,我也面临着我的问题。若你们得到了解决方案,你们能分享一下更新吗?请检查我下面的答案
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(0.5 * Double(NSEC_PER_SEC)) / Double(NSEC_PER_SEC), execute: {

    // your code here

 })