views:

20

answers:

0

Hi all, I'm having a problem with a nested resource returning null (specifically <responsible_user>). On the server side, I have a tasks.xml file with this schema:

<tasks> 
   <task> 
      <id>1</id> 
      <text>Something to do...</text> 
      <completed>false</completed> 
      <project> 
         <id>1</id> 
         // project info 
      </project> 
      <responsible_user> 
         <id>2</id> 
          <username>andrew</username> 
          // user info for the user responsible for task 
      </responsible_user> 
      <user> 
         <id>2</id> 
         <username>andrew</username> 
         // user info for the user who created task 
      </user> 
   </task> 
<tasks>

And in my iPhone app, I have a Project model, Task model, and User model. Here's my Task header file:

@interface Task : NSObject { 
   Project    *project; 
   User       *user; 
   User       *responsibleUser; 
   NSString   *taskId; 
   NSString   *text; 
   NSString   *completed; 
} 

@property (nonatomic, retain) Project *project; 
@property (nonatomic, retain) User *user;
@property (nonatomic, retain) User *responsibleUser;
@property (nonatomic, retain) NSString *taskId; 
@property (nonatomic, retain) NSString *text; 
@property (nonatomic, retain) NSString *completed;

@end

When I retrieve the tasks, I can get the project info (via task.project) and the user info (via task.user) but task.responsibleUser is returning null. I tried removing the <user> part of the xml (just incase they're "clashing"), but it still returned null.

Also, and this is really strange, getting the task id via task.taskId is returning the id from <responsible_user> instead of <task>. What the heck is going? Thanks :)

(Reposted from the ObjectiveResource google group, but trying here too since there aren't many members over there.)