1.使用百度地图报BMK_SEARCH_PERMISSION_UNFINISHED(还未完成鉴权,请在鉴权通过后重试)错误
原因是 在这个方法onGetPermissionState还没授权完就开始掉 定位或反地理搜索
解决方案:解决方案:需要先等BMKMapManager调用start:generalDelegate:之后的onGetPermissionState回调返回0之后,表示你已经取得权限,才能调用地图POI数据接口
2.UIWebview加载https链接空白的问题
在你的webView所在视图控制器中加入下面这三个方法 参考链接地址 http://stackoverflow.com/questions/11573164/uiwebview-to-view-self-signed-websites-no-private-api-not-nsurlconnection-i
/**这两个字段为了适配UIWebview 适配https*/
@property (nonatomic, assign) BOOL authenticated;
@property (nonatomic, strong) NSURLRequest *failedRequest;
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
BOOL result = _authenticated;
if (!_authenticated) {
_failedRequest = request;
NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[urlConnection start];
}
return result;
}
-(void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
//NSURL* baseURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@", wwjWebView.request.URL]];
NSURL* baseURL = [_failedRequest URL];
if ([challenge.protectionSpace.host isEqualToString:baseURL.host]) {
DLog(@"trusting connection to host %@", challenge.protectionSpace.host);
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
} else
DLog(@"Not trusting connection to host %@", challenge.protectionSpace.host);
}
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)pResponse {
_authenticated = YES;
[connection cancel];
[wwjWebView loadRequest:_failedRequest];
}
3. SDWebImage加载Https图片失败
在使用sd_setImageWithURL: 加载图片时,将options 这个参数设置为SDWebImageAllowInvalidSSLCertificates就好了
这是我项目中用到的 到时根据自己的需要来添加 不知道为什么有时会不起作用
WeakSelf(weakSelf);
[self.avatarImageView sd_setImageWithURL:url placeholderImage:placeImage options:SDWebImageAllowInvalidSSLCertificates | SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
weakSelf.avatarView.backgroundColor = [UIColor colorWithHex:0xe7e5ea];
}];
方法二、在sdwebimage中 找到SDWebImageDownloaderOperation.m文件 用下面的方法把那个方法替换掉 本人已经试过了 可以使用的
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge previousFailureCount]== 0) {
//NSURLCredential 这个类是表示身份验证凭据不可变对象。凭证的实际类型声明的类的构造函数来确定。
NSURLCredential* cre = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
[challenge.sender useCredential:cre forAuthenticationChallenge:challenge];
}
else{
}
}
4. 环境 xCode8 iOS10 操作:新浪微博的第三方登录 kCFStreamErrorDomainSSL, -9824
此问题应该是ssl证书版本不兼容的问题 在项目info.plist中像下面的图配置一下就可以了 记得要clean一下 在试试 也可以参考https://github.com/sinaweibosdk/weibo_ios_sdk 配置白名单

网友评论