Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you sure it's the way that you're calling the methods that's the issue and not what they contain? </p> <p>A few Questions that May Help. </p> <p>1) Are the returned strings static or are they dynamic? </p> <pre><code>NSString *string = @""; //Static </code></pre> <p>VS</p> <pre><code>NSString *string = [NSString stringWithFormat:@"%@",[NSArray objectAtIndex:0]]; // Dynamic </code></pre> <p>If it's dynamic and the input is null it could crash, example trying to get an index from a empty array. </p> <p>2) Is there any condition where one of the strings could be returned non initialized? </p> <pre><code>NSString *string; // Not Initialized </code></pre> <p>VS </p> <pre><code>NSString *string = @""; // Initialized </code></pre> <p><em><strong>EDIT</em>*</strong> </p> <p>Also now that I see the code above why are you doing a <strong>@try @catch</strong> ? </p> <p>That may work fine in PHP but in iOS it's not the way to go. Direct From Apple's Docs. </p> <blockquote> <p>"You should not use a try-catch block in place of standard programming checks for Objective-C methods. In the case of an NSArray, for example, you should always check the array’s count to determine the number of items before trying to access an object at a given index. The objectAtIndex: method throws an exception if you make an out-of-bounds request so that you can find the bug in your code early in the development cycle—you should avoid throwing exceptions in an app that you ship to users."</p> </blockquote> <p><a href="http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/ProgrammingWithObjectiveC/ErrorHandling/ErrorHandling.html" rel="nofollow">http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/ProgrammingWithObjectiveC/ErrorHandling/ErrorHandling.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload