actually i have used this code for converting NstaggedpointerString to string
NSString *index = [responseSelectedAvailibility[i] valueForKey:@"day"];
NSLog(@"String %@",index);
int indexDayValue = (int)index;
NSLog(@" index %d",indexDayValue);
indexDayValue = indexDayValue-1;
NSLog(@" index after decrementing %d",indexDayValue);
i get output of string is like this
String
(
1
)
now how i get this 1.
Replace this:
int indexDayValue = (int)index;
with this:
int indexDayValue = [index intValue];
Edit:
[__NSArrayI intValue] unrecognized selector sent to instance 0x7f940053f7e0
That's because index is in fact an array, not a string. Do the following:
NSDictionary *dict = responseSelectedAvailibility[i];
NSArray *dayArray = dict[@"day"];
NSString *dayIndexString = [dayArray firstObject];
int dayIndex = [dayIndexString intValue];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With