相关疑难解决方法(0)

Swift中的NSFastEnumeration

我试图将Objective-C项目转换为swift,但我无法找到如何将NSFastEnumeration用于符合NSFastEnumeration的类的对象.

这是ObjC中的代码:

//  get the decode results
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];

ZBarSymbol *symbol = nil;
for(symbol in results)
    // just grab the first barcode
    break;
Run Code Online (Sandbox Code Playgroud)

到目前为止,我试图找到如何做到这一点,但这似乎不起作用,这里是快速的代码:

var results: ZBarSymbolSet = infoDictionary?.objectForKey(ZBarReaderControllerResults) as ZBarSymbolSet

    var symbol : ZBarSymbol? = nil;

    for symbol in results
    {    //just grab first barcode
        break;
    }
Run Code Online (Sandbox Code Playgroud)

条件错误 - "ZBarSymbolSet"没有名为"Generator"的成员

我究竟做错了什么?

这是屏幕截图 在此输入图像描述

objective-c ios swift

14
推荐指数
1
解决办法
5489
查看次数

来自NSURL的Swift PHAsset

我正在使用Swift上的PHAsset和NSURL.我有一个图片网址,例如file:///var/mobile/Media/DCIM/100APPLE/IMG_0043.JPG.

如何在Swift中使用NSURL制作PHAsset?

image nsurl ios swift phasset

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

标签 统计

ios ×2

swift ×2

image ×1

nsurl ×1

objective-c ×1

phasset ×1