title: Trouble with Parse Relations
body: <pre><code>// Posts a message to the backend database
  - (void)postMessage:(NSString *)message
  {
      // return right away if message is nil or all whitespace
      if (!message || ![[message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]) {
      return;
      }
  
  
      // Create new Message object and set relationships
      PFObject *postedMessage = [PFObject objectWithClassName:@"Message"];
      postedMessage[@"text"] = message;
  
      PFRelation *tagRelation = [postedMessage relationForKey:@"tags"];
  
      NSMutableArray *tags = [self generateTagsFromMessage:message];
      NSLog(@"Number of Tags Found: %lu", (unsigned long)[tags count]);
  
      [PFObject saveAllInBackground:tags block:^(BOOL succeeded, NSError *error) {
          for (PFObject *tag in tags) {
        //      [tagRelation addObject:tag];
              NSLog(@"%@", tag[@"text"]);
              [tag setObject:postedMessage forKey:@"message"];
          }
      }];
  
      [postedMessage saveInBackground]
  }
  </code></pre>
  
  <p>I am using Parse as the back end for my application, but am having inexplicable difficulty creating a one-to-many relationship.</p>
  
  <p>The idea is to make it so that users can post messages to the database with a tag on them, and the database stores Messages as one class, and Tags as another. The Message class has a "tags" field intended to store all tags in the message, and the Tag class has a "message" field intended to store the parent message of the tag. I thought I followed the tutorial of how to create a One-to-many relationship in Parse very well, but no matter what I cannot see the relationship on the Data Browser in Parse. </p>
  
  <p>I have tried getting the relation to work by both simply setting the postedMessage as the newTag's message field, and also by creating a PFRelation * for the tags field of the message and adding tags to that. None of it works.</p>
  
  <p>Does anybody know what my problem might be?</p>
  
  <p>Thank you!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Specifically, the problem is that no relation is formed between the objects. By inspecting the data browser I can see that both the "tags" relational field of Message and "message" relational field of Tag remain blank after running this code.</p>