ios - 更新到XCode 5.1后出现错误

标签 ios objective-c xcode compiler-errors

PCSEQAudioBar

嗨,我正在开发一个使用PCSEQAudioBar的应用程序,它在 Xcode 5.0.2 上运行良好,并将其更新为 5.1 后,突然开始出现此错误。.再也无法编译或部署我的代码它或任何东西

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

我在这条线上收到此错误…
CGGradientRef _gradientRef = CGGradientCreateWithColorComponents(rgb, (__bridge CFArrayRef) colors, NULL, sizeof(colors) / (sizeof(colors[0]) * 4));

请帮助…预先感谢..

最佳答案

您需要传递CGFloat数组,而不是NSArray

例如:

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

有关该API的更多信息,请访问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.

关于ios - 更新到XCode 5.1后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22608555/

相关文章:

ios - 滚动垂直 Collection View 以及整个 View

ios - 有谁知道如何呈现像 UIAlertController 这样的 SelectFooViewController

ios - presentViewController 显示黑页

ios - 问题 找不到自动链接框架 'FirebaseMessaging'

ios - 如何在实体中保存多个人(CoreData)

ios - 如何使用 CADisplayLink 更新以编程方式生成的 UILabel?

ios - 我如何从这个数组中快速获取菜单

android - 为每个数据条目在一行上显示带有按钮的数据

objective-c - 使用 NSFetchedResultsController 从 UITableView 中删除

ios - 如何判断自定义 UISearchBar 中的 UITableView 是否被触摸?