Note that there are some explanatory texts on larger screens.

plurals
  1. POData passed from view controller returning null
    primarykey
    data
    text
    <p>I have 2 view controllers and I pass data from 1 to 2 but the NSString in 2 is empty(null) what am I doing wrong?</p> <p><strong>view controller 1 .m</strong></p> <pre><code> - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { NSLog(@"Method 1"); return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"Method 2"); NSLog(@"%lu", (unsigned long)[allPosts count]); return [[[allPosts objectForKey:@"posts"] valueForKey:@"title"] count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Method 3"); static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.textLabel.text = [NSString stringWithFormat:@"%@", [[[allPosts objectForKey:@"posts"] valueForKey:@"title"] objectAtIndex:indexPath.row]]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { OldPostViewController *vc = [[OldPostViewController alloc] init]; NSString *url = [NSString stringWithFormat:@"server/app/post.php?id=%@", [[[allPosts objectForKey:@"posts"] valueForKey:@"id"] objectAtIndex:indexPath.row]]; vc.postURL = url; NSLog(@"%@", vc.postURL); [self performSegueWithIdentifier:@"viewPost" sender:self]; } </code></pre> <p><strong>view controller 2 .h</strong></p> <pre><code> #import &lt;UIKit/UIKit.h&gt; @interface OldPostViewController : UIViewController &lt;UIWebViewDelegate&gt; @property (weak, nonatomic) IBOutlet UIWebView *blogView; @property (strong, nonatomic) NSString *postURL; @end </code></pre> <p><strong>view controller 2 .m</strong></p> <pre><code>NSLog(@"URL: %@", _postURL); NSString *fullURL = _postURL; NSURL *url = [NSURL URLWithString:fullURL]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [blogView loadRequest:requestObj]; </code></pre> <p>Please could any one tell me what I could possibly do as I have try all the solutions I could find on Google &amp; Stackoverflow</p>
    singulars
    1. This table or related slice is empty.
    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. 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