Xcode常见的bug总结(二)

1> Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UICollectionView.m:2161

问题描述
在创建UICollectionVIew的头部视图的时候 ,返回的是nil,就会出现这个bug ,不是没有注册的问题。
解决方法
检查- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath;这个方法里面的返回值是否有问题。

2> [MT] IBPlatformTool: *** Failed to launch tool with description System content for IBCocoaTouchFramework-EightAndLater scaleFactor=2x: Failed to find or create execution context for description ' System content for IBCocoaTouchFramework-EightAndLater scaleFactor=2x'. These intermediate objects were non-nil: IBSimDeviceTypeiPad2x (com.apple.dt.Xcode.IBSimDeviceType.iPad-2x),iOS 12.4 (12.4 - 16G73-com.apple.CoreSimulator.SimRuntime.iOS-12-4

: Failed to find a suitable device for the type IBSimDeviceTypeiPad2x (com.apple.dt.Xcode.IBSimDeviceType.iPad-2x) with runtime iOS 12.4 (12.4 - 16G73) - com.apple.CoreSimulator.SimRuntime.iOS-12-4 (Failure reason: Failed to create new simulator device that matches IBSimDeviceTypeiPad2x (com.apple.dt.Xcode.IBSimDeviceType.iPad-2x) for runtime iOS 12.4 (12.4 - 16G73) - com.apple.CoreSimulator.SimRuntime.iOS-12-4 (Invalid runtime: com.apple.CoreSimulator.SimRuntime.iOS-12-4)):
Underlying Errors:
Description: Failed to find a suitable device for the type IBSimDeviceTypeiPad2x (com.apple.dt.Xcode.IBSimDeviceType.iPad-2x) with runtime iOS 12.4 (12.4 - 16G73) - com.apple.CoreSimulator.SimRuntime.iOS-12-4
Failure Reason: Failed to create new simulator device that matches IBSimDeviceTypeiPad2x (com.apple.dt.Xcode.IBSimDeviceType.iPad-2x) for runtime iOS 12.4 (12.4 - 16G73) - com.apple.CoreSimulator.SimRuntime.iOS-12-4 (Invalid runtime: com.apple.CoreSimulator.SimRuntime.iOS-12-4)
Underlying Errors:
Description: Invalid runtime: com.apple.CoreSimulator.SimRuntime.iOS-12-4

解决方法
先command+Shift+K,然后command+option+shift+K ,然后重启电脑。(解决方法就是这个神奇)

3> control may reach end of non-void function

今天用Code调试出现了这个错误提示“control may reach end of non-void function”。
同样的项目在Xcode10.3之前没有问题,但升级Xcode10.3以后项目中有好几处出现了这个错误。

问题分析
函数在类的实现里面没有写返回值

解决方法
在函数内加上相对应类型的返回值就行了

4>:在集成QQ登录的时候控制台打印

{"ret":100008,"msg":"client request's api name is not existed"}

错误原因
因为App内设置的AppID和appsecret不正确。

解决方法
检查设置AppID和AppSecreat地方替换成正确的即可。

5:在集成微信登录的时候出现获取不到access_token的问题控制台打印

{"errcode":40125,"errmsg":"invalid appsecret, view more at http://t.cn/RAEkdVq, hints: [ req_id: NfnD36yFe-WOxDWA ]"}

错误原因
提示appsecret有问题,App内是写死的appsecret,在以前集成微信分享的时候,感觉appsecret不会有问题,也查询了很多信息,没有解决。谁知道appsecret居然被后台的同学重置过,让后台的同学发了一下重置过后的appsecret问题就解决了。

解决方法
找到正确的appsecret或者在微信后台重置appsecret即可。

你可能感兴趣的:(Xcode常见的bug总结(二))