• Dominic Blythe
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Software Architect
  • Alpha Financial Markets Consulting

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
I'm building an iOS hybrid mobile app by altering the AccountEditor example, using MobileSDK 2.1. It's going quite well but I've hit something odd. The sample apps have an online/offline indicator and SmartSync handles this nicely, going to the local copies of records when there's no connection and querying the server when connected. It offers to sync locally modified records when it comes back online. All very nice.

My problem is that I'm also creating records. When I create a record offline, and then go and view it offline, that specific record is returned from the query with no result.attributes while the records that were created online do have result.attributes, even when viewed offline. I have peppered the standard js with console.log(...) to find out what's going on.

Here are some excerpts:

Dumping out all the properties of result (cache query result) entry for the record added offline. Note no "attributes" property. The records created online DO have an "attributes" property.
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 _soupEntryId:7
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 Meeting__c:a0qM0000001PCduIAG
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 Id:local_1389031510806592
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_created__:true
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 type:Portfolio_Meeting__c
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_updated__:false
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 Client_Portfolio__r:[object Object]
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __local__:true
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 _soupLastModifiedDate:1389031510814
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 Client_Portfolio__c:a0DM00000085zYyMAI
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_deleted__:false
2014-01-06 18:07:26.850 Mobile_Dev01_b[3515:70b] [LOG] 1514 Interest_Level__c:High

The error that causes the Success Callback to fail - smartsync.js Force.SObjectCollection parse method is trying to parse the result but can't:
 
2014-01-06 18:07:26.850 Mobile_Dev01_b[3515:70b] [LOG] 'undefined' is not an object (evaluating 'result.attributes.type') -[object Arguments]-

Anyone have any ideas?
I'm building an iOS hybrid mobile app by altering the AccountEditor example, using MobileSDK 2.1. It's going quite well but I've hit something odd. The sample apps have an online/offline indicator and SmartSync handles this nicely, going to the local copies of records when there's no connection and querying the server when connected. It offers to sync locally modified records when it comes back online. All very nice.

My problem is that I'm also creating records. When I create a record offline, and then go and view it offline, that specific record is returned from the query with no result.attributes while the records that were created online do have result.attributes, even when viewed offline. I have peppered the standard js with console.log(...) to find out what's going on.

Here are some excerpts:

Dumping out all the properties of result (cache query result) entry for the record added offline. Note no "attributes" property. The records created online DO have an "attributes" property.
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 _soupEntryId:7
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 Meeting__c:a0qM0000001PCduIAG
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 Id:local_1389031510806592
2014-01-06 18:07:26.848 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_created__:true
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 type:Portfolio_Meeting__c
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_updated__:false
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 Client_Portfolio__r:[object Object]
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __local__:true
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 _soupLastModifiedDate:1389031510814
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 Client_Portfolio__c:a0DM00000085zYyMAI
2014-01-06 18:07:26.849 Mobile_Dev01_b[3515:70b] [LOG] 1514 __locally_deleted__:false
2014-01-06 18:07:26.850 Mobile_Dev01_b[3515:70b] [LOG] 1514 Interest_Level__c:High

The error that causes the Success Callback to fail - smartsync.js Force.SObjectCollection parse method is trying to parse the result but can't:
 
2014-01-06 18:07:26.850 Mobile_Dev01_b[3515:70b] [LOG] 'undefined' is not an object (evaluating 'result.attributes.type') -[object Arguments]-

Anyone have any ideas?