title: How do I solve this Automatic Reference Counting (ARC) conflict?
body: <p>I have a <code>UIViewController</code> that requires the Facebook login button to be present in the screen. Now, Facebook iOS button requires the ARC to be OFF.</p>
  
  <p>On the other hand, in the same <code>UIViewController</code> I am using <code>NSTimer</code> to show few photos as a slideshow at the background - this feature requires ARC setting.</p>
  
  <p>So, I have a single file that requires ARC for one of the components, while not for other.</p>
  
  <p>The exact problem is in this code:</p>
  
  <pre><code>-(void)handleTimer {
  
      [UIView transitionWithView:imageView duration:3 options:(UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionCurveEaseInOut) animations:^{
          imageView.image = [UIImage imageNamed:[myImages objectAtIndex:imagePtr]];
      } completion:nil];
  
      if(imagePtr == (myImages.count) - 1)
          imagePtr = 0;
      else
          imagePtr = imagePtr + 1;
  }
  </code></pre>
  
  <p>If I disable ARC for the file that has this code, it throws an error at this line:</p>
  
  <pre><code>imageView.image = [UIImage imageNamed:[myImages objectAtIndex:imagePtr]];
  </code></pre>
  
  <p>The error reads:</p>
  
  <pre><code>Thread 1 : EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  </code></pre>
  
  <p>Actually, I have a time as you see above, to continuously update the image in imageView.</p>
  
  <p>myImageView is of type </p>
  
  <pre><code>@property (nonatomic, assign) IBOutlet UIImageView *imageView;
  </code></pre>
  
  <p>So, what is the problem here? </p>
  
  <p>Here is how myImages are initialized in viewDidLoad() method:</p>
  
  <pre><code>@interface ViewController () {
      UIImage *nextImage;
      NSArray *myImages;
      int imagePtr;
  }
  @end
  
  @implementation ViewController
  @synthesize imageView;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      myImages = @[@"image1.jpg", @"image2.jpg", @"image3.jpg", @"image4.jpg", @"image5.jpg", @"image6.jpg", @"image7.jpg", @"image8.jpg", @"image9.jpg",
                   @"image10.jpg", @"image11.jpg", @"image12.jpg", @"image13.jpg",
                   @"image14.jpg", @"image15.jpg", @"image16.jpg", @"image17.jpg",
                   @"image18.jpg", @"image19.jpg", ];
      imagePtr = 0;
  
      NSTimer *timer;
  
      imageView.image = [UIImage imageNamed:[myImages objectAtIndex:imagePtr]];
      imagePtr = imagePtr + 1;
  
      //imageView.image = [UIImage imageNamed:[myImages objectAtIndex:imagePtr]];
  
      timer = [NSTimer scheduledTimerWithTimeInterval: 3
                                               target: self
                                             selector: @selector(handleTimer)
                                             userInfo: nil
                                              repeats: YES];
  
      // Do any additional setup after loading the view, typically from a nib.
  }
  </code></pre>