Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode Adobe Creative SDK文件Swift_Xcode_Swift_Sdk_Adobe_Creative Cloud - Fatal编程技术网

Xcode Adobe Creative SDK文件Swift

Xcode Adobe Creative SDK文件Swift,xcode,swift,sdk,adobe,creative-cloud,Xcode,Swift,Sdk,Adobe,Creative Cloud,我正在尝试用Swift重写下面的代码。然而,在Swift中,itemSelections表示它必须是[AnyObject]的一种类型。有没有办法绕过这个问题?谢谢 Adobe代码 - (void)showFileChooser { [[AdobeUXAssetBrowser sharedBrowser] popupFileBrowser:^(AdobeSelectionAssetArray *itemSelections) { NSLog(@"Selected a file"); for(id

我正在尝试用Swift重写下面的代码。然而,在Swift中,itemSelections表示它必须是[AnyObject]的一种类型。有没有办法绕过这个问题?谢谢

Adobe代码

- (void)showFileChooser {

[[AdobeUXAssetBrowser sharedBrowser] popupFileBrowser:^(AdobeSelectionAssetArray *itemSelections) {
NSLog(@"Selected a file");
for(id item in itemSelections) {

AdobeAsset *it = ((AdobeSelectionAsset *)item).selectedItem;

NSLog(@"File name %@", it.name);
}
...
快速转换

AdobeUXAssetBrowser.sharedBrowser().popupFileBrowser({ (itemSelections:[AnyObject]!) -> Void in
这应该起作用:

AdobeUXAssetBrowser.sharedBrowser().popupFileBrowser({ (itemSelections) in
    if let itemSelectionsAssets = itemSelections as? [AdobeSelectionAsset] {
        for itemSelectionAsset in itemSelectionsAssets {
            let item = itemSelectionAsset.selectedItem
            println("File name: \(item.name)")
        }
    }
}

我没有AdobeCreativeSDK,但似乎您可以简单地将解决方案应用到前面的问题:
作为[AdobeSelectionAsset]
{…}