Sémantique Question: Incompatible pointeur de conversion d'entier à envoyer des " NSUInteger *' (aka 'unsigned int *') paramètre de type 'NSUInteger'
Si je reçois ce avertissement :
Semantic Issue: Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *') to parameter of type 'NSUInteger' (aka 'unsigned int')
Fondamentalement, je suis en tirant sur un flux JSON.. boucle à travers elle de faire correspondre les colonnes avec des données, puis de placer les données dans un objet pour être utilisé dans une ligne de la table...
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];
}
Chacun des StudyRow.... lignes donne l'avertissement.. et je n'ai aucune idée de pourquoi.. des Idées?
Si vous lisez l'avertissement qu'il vous dit pourquoi "envoi" NSUInteger *' (aka 'unsigned int *') paramètre de type 'NSUInteger'" je.e vous êtes le passage de pointeurs au lieu d'objets.
Je n'ai pas lu l'avertissement.. mais étant nouveau à tout cela.. je l'ai lu que l'envoi d'un NSUinteger à un NSUinteger.. je n'ai pas le même avis, l' *...
Voici le véritable problème: Vous avez reçu un avertissement, mais a commencé avec l'hypothèse qu'il y a quelque chose d'étrange à propos de l'avertissement. L'hypothèse de départ devrait être qu'il ya quelque chose de mal avec le code, et que l'avertissement vais vous dire ce qui est faux.
Je n'ai pas lu l'avertissement.. mais étant nouveau à tout cela.. je l'ai lu que l'envoi d'un NSUinteger à un NSUinteger.. je n'ai pas le même avis, l' *...
Voici le véritable problème: Vous avez reçu un avertissement, mais a commencé avec l'hypothèse qu'il y a quelque chose d'étrange à propos de l'avertissement. L'hypothèse de départ devrait être qu'il ya quelque chose de mal avec le code, et que l'avertissement vais vous dire ce qui est faux.
OriginalL'auteur Critter | 2011-02-08
Vous devez vous connecter pour publier un commentaire.
Lignes comme ceci:
Devrait être
Ils sont primitifs, et non des pointeurs vers des objets (où vous auriez besoin de l'astérisque pour indiquer simplement que).
Tura : Merci pour la clarification d'édition!
Mon plaisir... 🙂
OriginalL'auteur Wevah
Devrait être NSUInteger varName, pas NSUInteger *varName. Ils sont primitifs.
OriginalL'auteur Joseph Tura