Re: Error In An App I'm making From A Tutorial I found
Re: Error In An App I'm making From A Tutorial I found
- Subject: Re: Error In An App I'm making From A Tutorial I found
- From: email@hidden
- Date: Wed, 17 Apr 2013 12:22:03 -0400
On Apr 17, 2013, at 9:48 AM, Harmony Neil <email@hidden> wrote:
> Hellow,
> I've been looking at a tutorial for objective c and xcode from http://www.raywenderlich.com/21320/objectively-speaking-a-crash-course-in-objective-c-ios6
> and I've fixed most of the errors. Anyway, I've only got 1 error left which I can't work out how to fix. Would anyone be able to tell me where I'm going wrong? I've put a dropbox link to my xcode project below.
> https://dl.dropboxusercontent.com/u/4231099/QuoteGen.zip
> Thanks,
> Harmony.
I didn't run the code, but to fix the build error, you want to change the line to:
int index = arc4random() % array_tot;
That picks a random number and then uses the modulus operation (% is the modulus operator in C-based languages) to get a value between 0 and array_tot - 1.
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden