iOS中一些Debug记录
点击按钮分享到好友或朋友圈没有反应,URLScheme正确,SendMessageToWXReq各个参数都不为空
问题所在:分享图片太大,微信分享图片最大32k,图片压缩后进行分享
iOS定位权限提示框一闪而过
产生原因:CLLocationManager的实例被释放了
解决方法:将其改为属性
@property (nonatomic, strong)CLLocationManager *manager;
HTTP请求报错:Error Code=-999 “cancelled”:
产生原因:AFNetworking中
- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(nullable NSString *)domain;
方法判断证书无效(或没有证书)后返回NO,导致当前请求被cancel。解决方法:在plist文件中设置HTTP请求配置和host地址的白名单,在AFNetworking请求中允许不进行证书验证,在请求中添加代码:
1
2
3AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy]; securityPolicy.validatesDomainName = NO; securityPolicy.allowInvalidCertificates = YES;
//设置manager的securityPolicy
manager.securityPolicy = securityPolicy;