简体   繁体   中英

Getting Error after updating to XCode 5.1

PCSEQAudioBar

Hi, I am developing an application which uses PCSEQAudioBar and it was working fine on Xcode 5.0.2 and after updating it to 5.1 , suddenly i started getting this error.. no more i can't compile my code or deploy it or anything…

Incompatible pointer types passing retainable parameter of type 'CFArrayRef' (aka 'const struct __CFArray *')to a CF function expecting 'const CGFloat *' (aka 'const float *') type

I am getting this error on this line…

CGGradientRef _gradientRef = CGGradientCreateWithColorComponents(rgb, (__bridge CFArrayRef) colors, NULL, sizeof(colors) / (sizeof(colors[0]) * 4));

Please help… Thanks in advance..

You need to pass CGFloat array and not an NSArray .

Ex:

static const CGFloat colors [] = { 
    0.894, 0.894, 0.894, 1.0, 
    0.694, 0.694, 0.694, 1.0
};

More on this API from Apple docs ,

The number of items in this array should be the product of count and the number of components in the color space. For example, if the color space is an RGBA color space and you want to use two colors in the gradient (one for a starting location and another for an ending location), then you need to provide 8 values in components—red, green, blue, and alpha values for the first color, followed by red, green, blue, and alpha values for the second color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM