有趣的代码 20170426  AFN 安全报错  与 20170517

1, 补 0


for(NSInteger i = 1; i < 13; i++){
            NSString * tempStr = [ NSString stringWithFormat: @"ic_main_item_%02ld.png", i ];
            [mutablePicStrs addObject: tempStr ];
        }




2, 代码块


if ([videoItem.uid isEqualToString: idStr ]   &&  (
{
                NSRange strRange = [ videoItem.name rangeOfString: nameStr ];
                BOOL isContainStr = strRange.location != NSNotFound ;
                isContainStr;
}
)      ) {}



腾讯云
视频
随心播 TILLiveSDKShow,
难以支持 pod AFN,
手工添加 AFN, 参照

AFNetworking 中Assigning to 'AFSSLPinningMode' from incompatible type 'unsigned long _Nullable'

解决方法: 
1)AFSecurityPolicy.m

self.SSLPinningMode =  [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];
改为
self.SSLPinningMode = (AFSSLPinningMode)  [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue];
2)AFNetworkReachability.m

 _networkReachability = CFRetain(reachability); 改为 _networkReachability = (SCNetworkReachabilityRef)CFRetain(reachability); 
3)添加依赖库,去除其他错误

Security.framework
MobileCoreServices.framework
SystemConfiguration.framework



AFN 安全 报错

reason __NSCFString * "A security policy configured with AFSSLPinningModeCertificate can only be applied on a manager with a secure base URL (i.e. https)" 0x000000017013bc60

我删除了 如下代码 , OK

AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode: AFSSLPinningModeCertificate];

    securityPolicy.allowInvalidCertificates = YES;

    securityPolicy.validatesDomainName = YES;

    manager.securityPolicy  = securityPolicy;

AFN Header base URL

Something like this should work (untested):

NSURL *baseURL = [NSURL URLWithString:@"http://example.com/api"];
NSString *path = @"resource/1";

AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];

[manager GET:path parameters:nil success:^(NSURLSessionDataTask *task, id responseObject)
 {
     // Success
     NSLog(@"Success: %@", responseObject);
 }failure:^(NSURLSessionDataTask *task, NSError *error)
 {
     // Failure
     NSLog(@"Failure: %@", error);
 }];
This would send a GET request to http://example.com/api/resource/1.




20170517

UIAnimation 的 duration ,不影响 dispatch_after 的 timeInterval,
好似 GCD的 优先级 更高一些。

ZheBannerView,
等 网络请求 回数据后, 再展示。
然后 我 在 viewWillDisappear 中,
close bannerView.

问题是,
好像 我先请求数据,点击进入子界面,
然后 viewWillDisappear 后,
好像 网络请求的数据 还没回来,
close bannerView 自然没什么用。

时间上的计算。

你可能感兴趣的:(有趣的代码 20170426  AFN 安全报错  与 20170517)