vivekvpandya / TipsAndTricksCFNetworkingDrupal

This is an iOS application that interact with a site made with Drupal 8 and it uses its REST web services.
4 stars 2 forks source link

Error: Blank body causes crash #2

Open jefflinwood opened 10 years ago

jefflinwood commented 10 years ago

If you don't add anything in the body field in the Drupal node, the app will crash with an exception on this line:

    [self.bodyWebView loadHTMLString:[self.tip objectForKey:@"body"] baseURL:nil];

Of TnTViewController.m

vivekvpandya commented 10 years ago

In my website I have all three fields mandatory for Tip. But it may be chance that for any other reason tip object or tip "body" object can be nil or "" if kept empty that In have put UIalertView to inform user about the failure.

jefflinwood commented 10 years ago

You can do that, or you can just put in a check to see if the body isEqualTo:[NSNull null] and then put in some default text like "No content found for: "

vivekvpandya commented 10 years ago

When body content is left blank, retrieved JSON has string in it So I have matched bodyHTML against that.