我正在尝试使用 CFStringCompare 来比较字符串,但我不断得到一个Could not find an overload for == that accepts the supplied arguments.
更具体地说,这段代码看起来像:
func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info: NSDictionary!)
{
let mediaType = info.objectForKey(UIImagePickerControllerMediaType) as String
if CFStringCompare(mediaType as NSString!, kUTTypeMovie, compareOptions: 0) == CFComparisonResult.CompareEqualTo
{
var moviePath : NSString = info.objectForKey(UIImagePickerControllerMediaURL).path
if UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath)
{
UISaveVideoAtPathToSavedPhotosAlbum(moviePath, nil, nil, nil)
}
}
else ...
我确定我只是搞砸了语法,但是我尝试将 mediaType 设为可选字符串并展开它:
let mediaType = info.objectForKey(UIImagePickerControllerMediaType) as String?
仍然could not find overload for ==
。
有任何想法吗?先感谢您!