title: Throwing Exception when sum up the response array values
body: <p>Hi I'm getting following exception when I try to sum up the values of a response array from both the method mentioned below.</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI intValue]: unrecognized selector sent to instance 0x1c463ade0'
  </code></pre>
  
  <h2>Tried code below</h2>
  
  <pre><code>-(void)getSelectedServiceTypeArray:(NSArray *)selectedServicesTypeArray
  {
      NSInteger sum = 0;
      selectedMultiServiceType = [[NSArray alloc]initWithObjects:selectedServicesTypeArray, nil];
      NSArray *priceArray = [selectedMultiServiceType valueForKey:@"price_per_unit"];
      NSLog (@"PriceArray%@",priceArray);
    //  sum = [priceArray valueForKeyPath:@"@sum.self"];
      for (NSNumber *num in priceArray)
      {
          sum += [num intValue];
          NSLog(@"SUMR1%ld",(long)sum);
      }
  
      NSLog(@"SSTAA%@",selectedMultiServiceType);
  
  
  }
  </code></pre>
  
  <p>Mean while I tried both the method for an array contains manually entered values. Anyway Both methods works for this..</p>
  
  <pre><code>NSArray *testArray = @[@"24",@"75",@"80",@"44"];
  
      NSNumber *sum = [testArray valueForKeyPath:@"@sum.self"];
      NSLog(@"SUM SUM1%@",sum);
  
  
       double sum2 = 0;
       for (NSNumber *serviceFeeTotal in testArray)
       {
       sum2  += [serviceFeeTotal doubleValue];
       }
       NSLog(@"SUM SUM2%f",sum2);
  </code></pre>
  
  <p>I don't why this not working and app is crashing on either of both methods when I using an array that retrieved from a previous ViewController by delegate method.</p>
  
  <p>Response of the array I tried to sum up</p>
  
  <pre><code>PriceArray(
          (
          30,
          45
      )
  )
  </code></pre>
  
  <p>Please explain me with a proper code...</p>
  
  <p>Thanks for the All the support I solved the issue by replacing following code</p>
  
  <pre><code>selectedMultiServiceType = [[NSArray alloc]initWithObjects:selectedServicesTypeArray, nil];
      **NSArray *priceArray = [selectedMultiServiceType[0] valueForKey:@"price_per_unit"];**
      NSLog (@"PriceArray%@",priceArray);
  </code></pre>