iphone - 语义问题 : Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *' ) to parameter of type 'NSUInteger'

标签 iphone objective-c ipad ios4 nsarray

所以我得到了这个警告:

Semantic Issue: Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *') to parameter of type 'NSUInteger' (aka 'unsigned int') 

基本上我正在拉取 JSON 提要.. 遍历它以将列与数据匹配,然后将数据放入一个对象中以在表行中使用...

NSDictionary *js_result = [response JSONValue];

NSLog(@"This is the LIST: %@",[js_result objectForKey:@"LIST"]);
//  get columns
NSArray *columns = [[js_result objectForKey:@"LIST"] componentsSeparatedByString:@","];
//  get data
NSArray *rows = [[js_result objectForKey:@"QUERY"] objectForKey:@"DATA"];



NSUInteger *study_id_int = (NSUInteger *)[columns indexOfObject:@"STUDY_ID_DICOM"];
NSUInteger *study_desc_int = (NSUInteger *)[columns indexOfObject:@"STUDY_DESCRIPTION"];
NSUInteger *study_date_int = (NSUInteger *)[columns indexOfObject:@"STUDY_DATETIME"];
NSUInteger *modality_int = (NSUInteger *)[columns indexOfObject:@"MODALITY"];
NSUInteger *referring_physician_name_int = (NSUInteger *)[columns indexOfObject:@"REFERRING_PHYSICIANS_NAME"];
NSUInteger *patient_id_dicom_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_ID_DICOM"];
NSUInteger *patient_name_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_NAME"];
NSUInteger *birth_date_int = (NSUInteger *)[columns indexOfObject:@"BIRTH_DATE"];
NSUInteger *institution_name_int = (NSUInteger *)[columns indexOfObject:@"INSTITUTION_NAME"];
NSUInteger *study_recvd_datetime_int = (NSUInteger *)[columns indexOfObject:@"STUDY_RECVD_DATETIME"];
NSUInteger *image_count_int = (NSUInteger *)[columns indexOfObject:@"Image_Count"];
NSUInteger *patient_study_count_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_STUDY_COUNT"];



StudyListRow *StudyRow = [[StudyListRow alloc] init];

for(NSMutableArray *i in rows)
{
    NSLog(@"ROW DATA: %@",i);
    StudyListRow *StudyRow = [[StudyListRow alloc] init];
    StudyRow.study_id_dicom = (NSString *)[i objectAtIndex:study_id_int];
    StudyRow.study_description = [i objectAtIndex:study_desc_int];
    StudyRow.study_datetime = [i objectAtIndex:study_date_int];
    StudyRow.modality = [i objectAtIndex:modality_int];
    StudyRow.referring_physician_name = [i objectAtIndex:referring_physician_name_int];
    StudyRow.patient_id_dicom = [i objectAtIndex:patient_id_dicom_int];
    StudyRow.patient_name = [i objectAtIndex:patient_name_int];
    StudyRow.birth_date = [i objectAtIndex:birth_date_int];
    StudyRow.institution_name = [i objectAtIndex:institution_name_int];
    StudyRow.study_recvd_datetime = [i objectAtIndex:study_recvd_datetime_int];
    StudyRow.image_count = [i objectAtIndex:image_count_int];
    StudyRow.patient_study_count = [i objectAtIndex:patient_study_count_int];



}

StudyRow.... 的每一行都给出了警告...我不知道为什么...想法?

最佳答案

像这样的行:

NSUInteger *study_id_int = (NSUInteger *)[columns indexOfObject:@"STUDY_ID_DICOM"];

应该是

NSUInteger study_id_int = (NSUInteger)[columns indexOfObject:@"STUDY_ID_DICOM"];

它们是原语,而不是指向对象的指针(您需要星号来表示这一点)。

关于iphone - 语义问题 : Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *' ) to parameter of type 'NSUInteger' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4938293/

相关文章:

iphone - 带有 webview 崩溃的页面 View Controller

iphone - 生成文件/目录名称的字符串

ios - 返回的对象类型与函数体 swift objc 中的对象类型不同

html - 没有 HTML 标记的 NSString

iphone - 尝试让我的应用通用

iphone - #import statements in .m or .h in objective-c?

iPhone SDK : Forcing landscape mode for a single part of an app

iphone - UIButton 通过动画调整大小

iphone - iPhone 上的同步与异步

ios - XMLReader Xcode 错误