1

In Xcode 6 beta 7 I'm not able to put an UIImage in AnyObject Array:

var objects = [pizzaImage.image, title, ingredients.text]

error: Cannot convert the expression's type 'Array' to type 'ArrayLiteralConvertible'

no problems in beta 6

EDIT this is the complete code, tried everything, but stil no luck:

var objects = [pizzaImage.image!, title, ingredients.text!]]
var act = UIActivityViewController(activityItems: objects, applicationActivities: nil)
self.presentViewController(act, animated: true, completion: nil)
4
  • 1
    Is it related to this ? stackoverflow.com/questions/25649875/… Commented Sep 3, 2014 at 21:15
  • unwrap the image have no effect in this case, sorry Commented Sep 3, 2014 at 21:22
  • @MarcelloCat: ingredients.text has to be unwrapped as well. Commented Sep 3, 2014 at 21:32
  • I tried everything, even the impossible! Commented Sep 3, 2014 at 21:47

1 Answer 1

1

Solved:

var objects = [pizzaImage.image!, title!, ingredients.text]]
var act = UIActivityViewController(activityItems: objects, applicationActivities: nil)
self.presentViewController(act, animated: true, completion: nil)

but if you put in only the title and the textField the complier has nothing to complain:

var objects = [title, ingredients.text]

why?? this is truly unclear...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.