[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

[Solved] Get specific NSMutableArray values [closed]

Looking at the data you posted, I see an outer array of dictionaries. Each of those dictionaries contains it’s own array of dictionaries. The inner dictionary contains your actual data, with keys NodeContent and NodeName. I’m guessing you want to traverse all the innermost dictionaries, looking for entires with a nodeName value of “MyID”, and … Read more

[Solved] How get the total sum of currency from a NSMutableArray [duplicate]

If the values are stored as NSNumber objects, you can use the collection operators. For example: NSArray *array = @[@1234.56, @2345.67]; NSNumber *sum = [array valueForKeyPath:@”@sum.self”]; If you want to format that sum nicely using NSNumberFormatter: NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; formatter.numberStyle = NSNumberFormatterDecimalStyle; NSString *result = [formatter stringFromNumber:sum]; NSLog(@”result = %@”, result); If … Read more

[Solved] How to get index of array element in cell? [closed]

Sorry if I’m understanding your English incorrectly, but I guess this is along the lines of what you want: You can get the indexPath of the row that was selected in a table by implementing tableView:didSelectRowAtIndexPath: in you tableView’s delegate (presumably your tableViewController). An indexPath has two properties you’ll be interested in; section and row. … Read more