DaffodilGirl 2013-06-21 07:47 采纳率: 0%
浏览 2324

iphone编程报出错误

对NSSet进行排序:

NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[[testSet.questions allObjects] sortedArrayUsingDescriptors:descriptor]; // warning

然后系统警告:

Incompatible pointer types sending 'NSSortDescriptor *__strong' to parameter of type 'NSArray *
  • 写回答

1条回答 默认 最新

  • ReyZhang 移动开发领域新星创作者 2013-06-23 12:54
    关注

    sortedArrayUsingDescriptors 后能跟的参数类型为NSArray类型。可以传多个NSSortDescriptor.
    你的代码中,只需要稍改一下就可以了

    [[testSet.questions allObjects] sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
    
    评论

报告相同问题?

悬赏问题

  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题