[Solved] Exception in button tag

The reason you are getting an exception is because your tag is greater then the blogids count. Add the buttons to the array and then it will not crash. For example: blogids = [[NSMutableArray alloc]init]; [blogids addObject:oneOfYourButtons]; Also if you only want to see the tags number use this: NSLog(@”The tag clicked:%d”,tag); instead of: NSLog(@”The … Read more

[Solved] Sum of two array [closed]

NSArray *firstArray=[NSArray arrayWithObjects:@”1″,@”2″,@”3″, nil]; NSArray *secondArray=[NSArray arrayWithObjects:@”10″,@”20″,@”30″, nil]; NSMutableArray *sumArray=[NSMutableArray new]; for (NSInteger i=0; i<[firstArray count]; i++) { NSString *newValue=[NSString stringWithFormat:@”%ld”,([[firstArray objectAtIndex:i]integerValue] + [[secondArray objectAtIndex:i]integerValue])]; [sumArray addObject:newValue]; } NSLog(@”sum=%@”,sumArray); Output is : sum=( 11, 22, 33 ) NOTE: both firstArray & secondArray must be of same size, and contain integers as string. Otherwise you need … Read more

[Solved] ObjectAtIndex method of an NSMutableArray Object [closed]

Likely it is a memory management issue. Are you abiding by rules set out in the Memory Management Programming Guide? Try: revising the memory management rules, make sure you are not using any objects that you don’t own, make sure you are retaining objects you want to keep (and releasing them appropriately afterwards); running your … Read more

[Solved] Accessing Coordinates in Plist – iOS [closed]

NSMutableDictionary *root = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; NSDictionary *routes = [root objectForKey: @”Routes”]; NSArray *cities = [routes allValues]; for (NSDictionary *city in cities) { NSArray *locations = [city allValues]; for (NSDictionary *loc in locations) { NSDictionary *coord = [loc objectForKey:@”coordinate”]; NSLog(@”%@”,[coord objectForKey:@”latitude”]); } } 3 solved Accessing Coordinates in Plist – iOS [closed]

[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] unrecognized selector sent to instance in Array [duplicate]

Your problem is that the compiler thinks you’ve declared “m_ArrContactsOrgEntity” as something other than a NSMutableArray. Otherwise, you wouldn’t be seeing that “unrecognized selector” error. Another hint of advice for you, best practice in Objective-C is that variables should always start with lower case letters. Change “ObjIstructContacts“, “Qnarray” and “Qnstream” to start with lower case … Read more

[Solved] Get substring from string variable and save to NSMutableArray [closed]

NSString *str = @”M||100|??|L||150|??|S||50″; NSString *stringWithoutBars = [str stringByReplacingOccurrencesOfString:@”||” withString:@” “]; NSMutableArray *array = [[NSMutableArray alloc]initWithArray:[stringWithoutBars componentsSeparatedByString:@”|??|”]]; solved Get substring from string variable and save to NSMutableArray [closed]