iPhone: How to create dynamic instances for any built-in class object?
<p>I want to create dynamic instances for a built in class object. I am not sure how to achieve this.
For example, the below audio player object instance i want to create dynamically, so that I can play dynamic multiple data.</p>

<pre><code>audioPlayer = [[AVAudioPlayer alloc] initWithData:pData error:nil];
</code></pre>

<p>instead of this, i want to be something like below,</p>

<pre><code>audioPlayer1 = [[AVAudioPlayer alloc] initWithData:pData error:nil];
audioPlayer2 = [[AVAudioPlayer alloc] initWithData:pData error:nil];
audioPlayer3 = [[AVAudioPlayer alloc] initWithData:pData error:nil];
</code></pre>

<p>Here, 1, 2, 3 can be added dynamically, because i don't know how many i have to add at once, it has to be dynamically created. </p>

<p>I though i can do like, </p>

<pre><code>AVAudioPlayer *[NSString stringWithFormat:@"audioPlayer%d", value] = [[AVAudioPlayer alloc] initWithData:pData error:nil];
</code></pre>

<p>But this is not acceptable.</p>

<p>Could someone help me on this to resolve?</p>
