在Xcode 6 beta 7中,我无法在AnyObject数组中放置UIImage:
var objects = [pizzaImage.image, title, ingredients.text]
错误:
Cannot convert the expression's type 'Array' to type 'ArrayLiteralConvertible
“
beta 6中没有问题
修改 这是完整的代码,尝试了一切,但是没有运气:
var objects = [pizzaImage.image!, title, ingredients.text!]]
var act = UIActivityViewController(activityItems: objects, applicationActivities: nil)
self.presentViewController(act, animated: true, completion: nil)
答案 0 :(得分:1)
解决:
var objects = [pizzaImage.image!, title!, ingredients.text]]
var act = UIActivityViewController(activityItems: objects, applicationActivities: nil)
self.presentViewController(act, animated: true, completion: nil)
但是如果你只输入标题和textField,那么编译器就没有什么可抱怨的了:
var objects = [title, ingredients.text]
为什么? 这真的不清楚......