IOS端写demo打bug记
BUG甲
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
解决方案:
滑动到最后一个 item 会出现一个小加号,输入 Privacy 可以迅速定位到这一权限系列,找到你需要的权限,修改后面的 value 就可以了
当然也可以用如下方法添加:
1.在项目中找到info.plist文件,右键点击以 Source Code形式打开
2.添加以下键值对,这里以 PhotoLibrary 作为例子
NSPhotoLibraryUsageDescription
此 App 需要您的同意才能读取媒体资料库
BUG乙
Xcode setting ENABLE_BITCODE的问题
解决方案:就在图示的地方改一下就可以了。
BUG丙
“this class is not key value coding-compliant for the key xxx.”问题
解决方案:
这个报错表示IBOutlet或IBAction的设定有问题,因此重新设定即可。我是把所有的这些关联都删除掉,重新捋了一遍就可以了。我看了一下主要还是因为多次重复的拉关联,导致的这个问题。
Warning甲
Null passed to a callee that requires a non-null argument
此警告就是某属性说好的不能为空,你又在某地方写了XX = nil 所以冲突了
解决方案:
在声明一个属性的时候加上nullable就可以了
@property (nonatomic, copy, nullable) NSString tickets;
Warning乙
The iOS Simulator deployment target is set to x.x, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target ‘xxx’)
解决方案:
在podfile后添加
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
end
end
end
end
即可
Warning丙
_____ is deprecated: first deprecated in iOS 12.0 - OpenGLES API deprecated. (Define GLES_SILENCE_DEPRECATION to silence these warnings)_
解决方案:在预处理宏中添加GLES_SILENCE_DEPRECATION=1即可
Warning丁
Sending ‘ViewController *const __strong’ to parameter of incompatible type ‘id<某Delegate>’
解决方案:只需要在@interface 控制器名 后面加上<协议名>即可
Warning戊
处理完丁以后,出现Class ‘AudioVideoView’ does not conform to protocol ‘某Delegate’
这是因为要实现该Delegate的功能,但是这里没有实现,所以出现警告。
解决方案:实现Delegate的功能,但是如果不需要这里面的功能的话,不实现也行。