小编Ale*_*rth的帖子

SSL套接字连接iOS

我正在尝试建立与java运行SSLServerSocket的安全连接.

我创建了自己的根CA,并使用此证书签署了Java SSLServerSocket的证书.

我想将此根证书添加到我的应用程序,以便根证书签署的任何证书都可以.

到目前为止,我通过将读取和写入流属性设置为此来使安全连接正常工作:

NSDictionary *settings = [[NSDictionary alloc] initWithObjectsAndKeys:
(id)kCFStreamSocketSecurityLevelNegotiatedSSL, kCFStreamPropertySocketSecurityLevel,
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates,
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredRoots,
[NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,nil];
Run Code Online (Sandbox Code Playgroud)

我将证书添加到钥匙串,如下所示:

-(void)addRootCert{
NSString* rootCertPath = [[NSBundle mainBundle] pathForResource:@"rootCA" ofType:@"der"];
NSData* rootCertData = [NSData dataWithContentsOfFile:rootCertPath];

OSStatus err = noErr;
SecCertificateRef rootCert = SecCertificateCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)rootCertData);
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:(__bridge_transfer id)kSecClassCertificate, kSecClass, rootCert, kSecValueRef, nil];

err = SecItemAdd((__bridge CFDictionaryRef) dict, NULL);
if (err == noErr) {
    NSLog(@"Sucessfully added root certificate");
}else if (err == errSecDuplicateItem){
    NSLog(@"Root certificate already exists"); …
Run Code Online (Sandbox Code Playgroud)

sockets ssl certificate-authority ios root-certificate

8
推荐指数
1
解决办法
7867
查看次数

Xcode 4.6即时构建,运行和完成(模拟器iOS 6.1)

在xcode中,我尝试在我的应用程序中添加一个轻击手势,当我构建它时,它开始出现Xcode问题.它从构建,"在iPhone 6.1模拟器上运行"到"在iPhone 6.1模拟器上运行完毕".

如果模拟器关闭,它会启动黑屏,你无法点击主页按钮等.如果打开,没有任何反应,应用程序不会安装,但模拟器不会崩溃.

我已经尝试过armv6架构'修复',但这不起作用.我还清理了项目和项目数据.我也多次重置模拟器.

如果我将旧文件添加到我的新项目中,它可以达到一定程度(我将旧文件复制并粘贴到新项目中),但同样的情况也会发生.

感谢您的帮助!

注意:新的空白项目构建并运行正常.

编辑:撤消我以前的操作后它仍然无法工作,模拟器根据Finder响应,虽然屏幕保持黑色

-----------------------------------------

UPDATE

我在我的应用程序中有一个名为'resources'的文件夹,作为参考导入,从@ arthan.v线程的链接提供给我修复了问题.我所做的是将文件夹重命名为文件并重新导入它.

非常感谢你,我花了2天时间尝试修复它!

iphone xcode objective-c ios ios-simulator

7
推荐指数
1
解决办法
4471
查看次数

Photos.framework抛出<Error>:ImageIO:PNG zlib错误但仍提供UIImage

我在这里找到了一个类似的问题: iOS 8(Swift)如何摆脱这个错误:ImageIO:PNG zlib错误?但是有一些差异.

PHAsset从一个选择器中获取- 图像下载并正确显示(它使用PHCachingImageManager该类).

但是,当我尝试稍后从资产请求图像时:

[[PHImageManager defaultManager] requestImageForAsset:asset targetSize:AssetTargetSize
    contentMode:PHImageContentModeAspectFit options:nil 
    resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
        if (result)
            _image = result;
}
Run Code Online (Sandbox Code Playgroud)

result变量是指向一个UIImage对象,但不是有效的-我不能把它变成NSData的也不我可以通过xcode的快速查找.

在日志中我只收到以下消息:仅此<Error>: ImageIO: PNG zlib error而已.

我尝试按照链接问题的建议使请求同步,但没有区别.

PHAsset照片应用程序和照片选择器中都可以查看指向的图像.

frameworks objective-c uiimage ios photosframework

6
推荐指数
1
解决办法
1440
查看次数

UITableViewCell contentView背景的快速模糊

我已经做了一个UIViewController符合UITableViewDataSourceUITableViewDelegate协议,并有一个UITableViewas的子视图.

我已将backgroundView表的属性设置为a UIImageView,以便将图像显示为表的背景.

为了在单元格之间有自定义间距,我使行高度大于我想要的,并将单元格的contentView自定义为我想要的大小,使其看起来有额外的空间(遵循此SO答案).

我想为单元格添加模糊,以便背景模糊,我通过Brad Larson的GPUImage框架完成了这项工作.然而,这工作正常,因为我希望背景模糊在滚动时更新,滚动变得非常迟缓.

我的代码是:

//Gets called from the -scrollViewDidScroll:(UIScrollView *)scrollView method
- (void)updateViewBG
{
    UIImage *superviewImage = [self snapshotOfSuperview:self.tableView];

    UIImage* newBG = [self applyTint:self.tintColour image:[filter imageByFilteringImage:superviewImage]];

    self.layer.contents = (id)newBG.CGImage;
    self.layer.contentsScale = newBG.scale;
}

//Code to create an image from the area behind the 'blurred cell'
- (UIImage *)snapshotOfSuperview:(UIView *)superview
{
    CGFloat scale = 0.5;
    if (([UIScreen mainScreen].scale > 1 || self.contentMode == …
Run Code Online (Sandbox Code Playgroud)

performance image objective-c ios gpuimage

4
推荐指数
1
解决办法
3489
查看次数