Your use of { } do not make sense at all. Why do I have a feeling you are copying and pasting code without really knowing how it works...
This is how you use braces correctly:
Code:
if (this)
{
//run this code
//and that
}
if (this)
{
if (that)
{
//run some code
//run some more code
}
}
Excuse my terrible formatting, for some reason, I can't use tab here.
Here is your code partly fixed:
Code:
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if(event.type == UIEventSubtypeMotionShake)
{
NSLog(@"Iphone has been shook"); {
int index = arc4random % [soundArray count];
AVAudioPlayer* theSound = [soundArray objectAtIndex: index];
[theSound play];
}
}
There is one "{" that does not belong. Find it and remove it.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.
New app - See screenshots and details at
www.globaclock.com.
If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.