Author Topic: Chapter 13 - Refreshing the delivery status  (Read 8002 times)

robcobain

  • Newbie
  • *
  • Posts: 3
    • View Profile
Chapter 13 - Refreshing the delivery status
« on: February 18, 2013, 02:16:52 PM »
Hi Keith, I'm working through the book and I've come across an error that I can't figure out!

When I click on the any of the cells within the Delivery status scene, I get a Cocoa Error 1580, which I believe is NSValidationRelationshipLacksMinimumCountError.

I can't seem to find any solutions to resolve this issue! I've tried going back over several steps and my app works perfectly up until this part.

I have found the rest of your books to be unbelievably helpful, but obviously this wasn't an error you received!!

Any help you can give me would be greatly appreciated.

Thanks,
Rob

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
Re: Chapter 13 - Refreshing the delivery status
« Reply #1 on: February 18, 2013, 05:05:49 PM »
Rob,

The error you're experiencing has something to do with the relationship between the ShipmentEntity and the DeliveryStatusEntity. I recommend re-checking the relationship settings in your App's entity data model.

Make sure the shipments relationship has the To-Many Relationship check box unchecked. Next, make sure the deliveryStatus relationship has the To-Many Relationship check box checked.

If the problem isn't readily apparent, you can zip up your project and email it to directly to me:

kevin@iOSAppsForNonProgrammers.com

To zip up your project:

1. Launch the Finder App
2. Navigate to the directory that contains the project you are working with
3. Select the project folder
4. Click the Action button at the top of the Finder window and select the Compress <project name> option

Kevin

robcobain

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Chapter 13 - Refreshing the delivery status
« Reply #2 on: February 18, 2013, 06:01:04 PM »
Thanks Kevin,

Firstly, please accept my apologies for calling you Keith! I was getting a little stressed with not being able to correct the error!

I completely restarted the project from the beginning of chapter 12, and as soon as I rebuilt the data model, I knew the problem was the minimum count on the To-Many relationship being populated with something that it shouldn't have been!

Thank you for taking the time to reply.

Rob

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
Re: Chapter 13 - Refreshing the delivery status
« Reply #3 on: February 18, 2013, 11:04:40 PM »
No problem at all...glad you were able to figure it out!

Kevin

robcobain

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Chapter 13 - Refreshing the delivery status
« Reply #4 on: February 19, 2013, 08:16:56 AM »
Sorry Kevin,

I just have one more question. I've worked through to page 433 and now my app works perfectly in the simulator, thanks again!, however, when I try to run the app on my device I only get a blank deliveries scene, it looks as though the database doesn't exist on the device. Is this normal as I can't see any reference to testing the app on the devices.

I only ask as I'm trying to use a lot of the functionality you have kindly provided to make my own app work.

Thanks again for your help.
Rob

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
Re: Chapter 13 - Refreshing the delivery status
« Reply #5 on: February 19, 2013, 04:36:28 PM »
Rob,

That's exactly right. The database doesn't exist on the device, so that's why you're not seeing any records.

If you check out Chapter 13 - Managing Lists of Data, under the topic "Examining the App's Data", there is a discussion of how to copy an existing database to the Simulator or a device when your App first starts up. Here are the basic steps if you want to use the iDeliverMobileCD database on an iOS device:

1. Add the iDeliverMobileCD.sqlite file to your project's Support Files group
2. In the init method of the ABusinessObject class, add the following code that sets the copyDatabaseIfNotPresent flag to YES:

   - (id)init
   {
       self = [super init];
       if (self) {
           self.dbName = @"IndexedTableViewDemo";
      self.copyDatabaseIfNotPresent = YES;    // <-- Add this line of code
       }
       return self;
   }


When you run your App on the device or in the Simulator, it will determine if the database exists. If it doesn't, it will copy the database you included in your project to the App's Documents folder. You can check out the section of the book I mentioned above for more details.

P.S. If you have already run the App on your iOS device, an empty database was automatically added to the device. To get rid of this database, you can just remove the App from the device (hold your finger down on the icon in the Home screen until the icons jiggle and then delete the App)l

Kevin