-1

I am trying to create an array with a string using the tag value sent by UITapGestureRecogniser. I keep getting error warnings like cannot convert long __nullable for the following:

NSString *tappy = [tapped1.view.tag];

Please can someone shed some light on this for me....thanks!

  • Possible duplicate of [How do I convert NSInteger to NSString datatype?](http://stackoverflow.com/questions/1796390/how-do-i-convert-nsinteger-to-nsstring-datatype) – Larme Jun 07 '16 at 13:46
  • You can only put objects in a `NS(Mutable)Array`, but do you really have to pass through a `NSString`? You could use a `NSNumber`: `NSNumber *tappy = @(tapped1.view.tag)`, or `NSNumber *tappy = [NSNumber numberWithInteger:tapped1.view.tag];` – Larme Jun 07 '16 at 13:48

1 Answers1

1
NSString *tappy = [NSString stringWithFormat:@"%ld", tapped1.view.tag]

then add this string into your NSMutableArray.

Bhargav Soni
  • 1,067
  • 1
  • 9
  • 22