objective c - initialization makes pointer from integer without a cast -
okay, having hard time this. i've searched past hour on , don't doing wrong. i'm trying take currenttitle of sender, convert integer can use in call list.
nsstring *str = [sender currenttitle]; nsinteger *nt = [str integervalue]; // error appears // nsstring *nextscreen = [nsstring stringwithformat:@"screen_%@.jpg", [screenlist objectatindex:nt]];
i assume it's [str integervalue]
bit not being used, can't find example works.
thanks!
let's analyze error message:
initialization (nsinteger nt
) makes pointer (*
) integer ([str integervalue]
) without cast.
this means trying assign variable of non-pointer type ([str integervalue]
, returns nsinteger
) variable of pointer type. (nsinteger *
).
get rid of *
after nsinteger
, should okay:
nsstring *str = [sender currenttitle]; nsinteger nt = [str integervalue]; // error appears // nsstring *nextscreen = [nsstring stringwithformat:@"screen_%@.jpg", [screenlist objectatindex:nt]];
nsinteger
type wrapper machine-dependent integral data type, defined so:
#if __lp64__ || (target_os_embedded && !target_os_iphone) || target_os_win32 || ns_build_32_like_64 typedef long nsinteger; typedef unsigned long nsuinteger; #else typedef int nsinteger; typedef unsigned int nsuinteger; #endif
Comments
Post a Comment