小编Wil*_* GP的帖子

是什么触发了 iOS 14 上的“想要查找并连接到本地网络上的设备”权限通知?

除了 Bonjour 之外,哪些实际方法调用会在 iOS 14 上触发“想要查找并连接到本地网络上的设备”权限通知?

这是 WWDC 会话中有关此新权限的屏幕截图。作为概述,这只是有点帮助。我更感兴趣的是弄清楚所有方法调用会触发什么。

在此处输入图片说明

ios ios14

17
推荐指数
3
解决办法
1万
查看次数

创建视频缩略图时,PHImageManager.requestImageForAsset返回nil

对于某些视频,requestImageForAsset以UIImage为零完成.对于其他视频,它工作正常,我还没弄清楚为什么.

func createThumbnailForVideo(video: PHAsset) -> Future<NSURL> {
    let promise = Promise<NSURL>()
    let options = PHImageRequestOptions()
    options.synchronous = true

    imageManager.requestImageForAsset(video, targetSize: CGSizeMake(640, 640), contentMode: .AspectFill, options: options) { (image:UIImage!, info) -> Void in

        if image == nil {
            println("Error: Couldn't create thumbnail for video")
            promise.error(MyErrors.videoThumb())
        } else {
            if let thumbURL = self.savePhotoAsTemporaryFile(image) {
                promise.success(thumbURL)
            } else {
                promise.error(MyErrors.videoThumb())
            }
        }
    }

    return promise.future
}
Run Code Online (Sandbox Code Playgroud)

我也找回了请求的信息,但我不知道如何解释这些信息:

[PHImageResultIsDegradedKey: 0, PHImageResultWantedImageFormatKey: 4037, PHImageResultIsPlaceholderKey: 0, PHImageResultIsInCloudKey: 0, PHImageResultDeliveredImageFormatKey: 9999]
Run Code Online (Sandbox Code Playgroud)

ios swift

12
推荐指数
1
解决办法
7020
查看次数

从我的服务器加载的图片在iPad应用程序上的颜色错误

我正在开发一款iPad应用程序,用于展示摄影师的照片.这些照片会上传到网络服务器上,并直接通过应用程序提供,下载并使用以下方法显示:

if([[NSFileManager defaultManager] fileExistsAtPath:[url path]]){
    CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
    CGImageRef cgImage = nil;
    if(source){
        cgImage = CGImageSourceCreateImageAtIndex(source, 0, (CFDictionaryRef)dict);
    }

    UIImage *retImage = [UIImage imageWithCGImage:cgImage];

    if(cgImage){
        CGImageRelease(cgImage);
    }
    if(source){
        CFRelease(source);
    }

    return retImage;
}
Run Code Online (Sandbox Code Playgroud)

我可以观察到原始图片(从磁盘或Mac上的网页和摄影师的Mac上显示)和iPad上显示的照片颜色的显着变化(结果是错误的)应用程序,甚至在Safari中).

经过一些搜索,我发现了一些帖子,解释了iDevices如何不使用嵌入式颜色配置文件,所以我发现我是这样做的.使用以下信息保存照片:

colorspace:RGB,colorprofile:sRGB iec ...

我发现了一些文章(例如来自imageoptimanalogsenses的这个链接),我应该通过转换为sRGB来保存设备导出的图片,而不需要嵌入颜色配置文件,但我不知道怎么能这样做?每次我尝试(我没有photoshop,所以我使用命令行ImageMagick),结果图片有以下信息,仍然无法在我的iPad(以及我测试的任何其他iPad)上正确显示:

colorspace:RGB

以下是在iPhone或iPad上无法正确显示但在网络上无法正常显示的图片示例

我想将其转换为正确显示,任何想法都会受到欢迎:)

[编辑]我已成功使用以下参数使用photoshop的"save for web"选项获取正确的图像: 确定photoshop导出参数 但是我仍然无法将这些设置自动应用到我的所有照片中.

image colors ipad srgb ios

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

iOS 10测试版,访问键盘框架时崩溃

iOS 10 Beta 4

Xcode 8 Beta 1

访问键盘框架大小时出现崩溃,如下所示:

var keyboardFrame:CGRect = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue()
keyboardFrame = self.view.convert(keyboardFrame, from: nil)

var contentInset:UIEdgeInsets = self.scrollView.contentInset
contentInset.top = -keyboardFrame.size.height + (tabBarController?.tabBar.frame.size.height)!
contentInset.bottom = keyboardFrame.size.height - (tabBarController?.tabBar.frame.size.height)!
Run Code Online (Sandbox Code Playgroud)

日志显示:

[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/

ios swift ios10 xcode8

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

使用基于令牌的新身份验证进行VoIP推送?

我可以通过正常的推送通知和后端使用简单的node.js文件来获得基于令牌的新推送工作(不使用证书).

但是,我无法使用VoIP推送.我试过使用从PushKit派生的令牌 - creditials.token,但我总是得到400错误.

我似乎无法在网上找到任何信息.只是从WWDC提到基于令牌的auth也可以用于VoIP推送.

apple-push-notifications ios pushkit

5
推荐指数
1
解决办法
1998
查看次数

如何确定用户是否已打开iCloud Photo Library?

我正在访问用户的照片以便从PHPhotoLibrary上传,但我需要能够判断他们是否打开了iCloud Photo Library.

如果他们有iCloud照片库,那么他们将会有一张名为"所有照片"的相册 - 如果关闭iCloud Photo Library,他们就不会拥有这些照片.

objective-c ios

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

[PHCollectionList canContainCustomKeyAssets]:发送到实例的无法识别的选择器

现在,在最新版本的 iOS(iOS 9.2 和 iOS 9.3)上,获取 PHAssets 会崩溃。以前效果很好。

我收到的错误是:

[PHCollectionList canContainCustomKeyAssets]:无法识别的选择器发送到实例由于未捕获的异常“NSInvalidArgumentException”而终止应用程序

抛出异常的行是:

            PHFetchResult *fetchImage = [PHAsset fetchKeyAssetsInAssetCollection:(PHAssetCollection*)collection options:fetchOptions];
Run Code Online (Sandbox Code Playgroud)

这里有更多代码,供参考:

Class PHPhotoLibrary_class = NSClassFromString(@"PHPhotoLibrary");
        if (PHPhotoLibrary_class) {

            PHFetchResult *fetchResult = self.collectionsFetchResults[indexPath.section];
            PHCollection *collection = fetchResult[indexPath.row];

            cell.textLabel.text = collection.localizedTitle;

            PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];
            fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];
            PHFetchResult *fetchImage = [PHAsset fetchKeyAssetsInAssetCollection:(PHAssetCollection*)collection options:fetchOptions];
            PHAsset *asset = [fetchImage firstObject];

            PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
            options.resizeMode = PHImageRequestOptionsResizeModeExact;

            CGFloat scale = [UIScreen mainScreen].scale;
            CGFloat dimension = 90.0;
            CGSize size = …
Run Code Online (Sandbox Code Playgroud)

objective-c ios phasset

3
推荐指数
1
解决办法
1131
查看次数