[Solved] Compare 2 arrays of strings

Your code contains a lot of syntax errors. Please post actual code, I understand the issue you are talking about, that’s why I’m posting this answer. Please post questions with valid code, else you won’t get proper answer (Only get downvotes) Use the following code: NSArray *current = @[@”1″, @”6″, @”53″]; NSArray *newArr = @[@”1″, … Read more

[Solved] Objective C NSArray [closed]

Your array is an array literal which means it is immutable. In order to make an array that you can change, do this: NSArray *oneInfo = @[@{@”trackTime”:theTrack[@”seconds”],@”trackPrice”:theTrack[@”price”],@”trackWait”:theTrack[@”wait”]}]; NSMutableArray* somethingICanChange = [oneInfo mutableCopy]; [somethingICanChange addObject: moreData]; Note that, if you are not using ARC (why not?), somethingICanChange is an array that you own and needs to … Read more

[Solved] Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4] ‘

Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4] ‘ solved Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4] ‘

[Solved] getting NSArray objects using index numbers

Try this : NSArray *arr = @[@”ECE”,@”CSE”,@”MECH”,@”CIVIL”,@”AERO”,@”IT”,@”EEE”,@”EM”]; NSArray *indexNumberArray = @[@0,@2,@5,@7]; NSMutableArray *arrNew = [NSMutableArray new]; for (NSNumber *index in indexNumberArray) { [arrNew addObject:[arr objectAtIndex:[index integerValue]]]; } Output 3 solved getting NSArray objects using index numbers

[Solved] Sort a dictionary array when the key is given as the parameter

Try this : NSSortDescriptor * sortDescriptors = [[NSSortDescriptor alloc] initWithKey:@”name” ascending:YES]; // change your key here NSArray * arrSortDescriptors = [NSArray arrayWithObject:sortDescriptor]; NSArray * sortedArray = [yourArray sortedArrayUsingDescriptors:arrSortDescriptors]; NSLog(@”sortedArray %@”,sortedArray); 0 solved Sort a dictionary array when the key is given as the parameter

[Solved] Incompatible pointer types initializing ‘NSMutableArray *’ with an expression of type ‘NSArray *’ [closed]

Are you trying to create an NSMutableArray or an NSArray? You have declared the variable as being of type NSMutableArray*, but the expression on the right creates an NSArray. If you want this array to be mutable, change the receiver of arrayWithObjects: to be NSMutableArray; if not, change the declaration to correctly identify this as … Read more