Accessing NSMutableArray in class
<p>In class1 I create an object of class2. I then use a method on this object to set its NSMutableArray</p>

<pre><code>-(void) cloneArray: (NSMutableArray *) array{
    pictures = [NSMutableArray arrayWithArray:array];
}
</code></pre>

<p>Class2 is a ViewController which has a UIImageView. </p>

<p>I present the class2 object after creating it. This class then has its own methods which display the next image when a swipe is detected.</p>

<pre><code>-(void) nextImageSelector{
    if (counter == [pictures count]-1) {
    counter = 1; 
    asset = [pictures objectAtIndex:counter];
    ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];

    UIImage *fullScreenImage = [UIImage imageWithCGImage:[assetRepresentation fullScreenImage] scale:[assetRepresentation scale] orientation:[assetRepresentation orientation]];

    photo.image = fullScreenImage;

    }
</code></pre>

<p>The app crashes when calling the line </p>

<blockquote>
  <p>if (counter == [pictures count]-1)</p>
</blockquote>

<p>So I think it is crashing because the array is created for an object and then the next array is trying to be checked is for the class instance itself. </p>

<p>How can I fix this so that I can copy an array for this class2 to use in its own methods like the nextImageSelector?</p>
