Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional iPhone and iPad Database Application Programming
This is the forum to discuss the Wrox book Professional iPhone and iPad Database Application Programming by Patrick Alessi; ISBN: 978-0-470-63617-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional iPhone and iPad Database Application Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 24th, 2011, 11:57 AM
Registered User
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Xcode 4 and chapter 4 iPad code

I am trying to get the chapter 4 code working while using Xcode 4.

I am running into a problem basically at page 103. I have the code entered but surveys are not getting added to the list when I hit the "add" button.

I am still trying to work through the issue, but was wondering if anyone else has run into this and possibly solved it.

Thanks!
Reply With Quote
  #2 (permalink)  
Old February 24th, 2011, 12:57 PM
Registered User
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Fixed

I figured it out. I had skipped one line of code in the text, so nothing was getting updated.
Reply With Quote
  #3 (permalink)  
Old August 15th, 2011, 01:48 PM
Registered User
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm working on the code from Chapter 4, the Survey. I have compiled the code and installed it on my iPad. When I enter survey data, and sync my iPad in iTunes, it does not show up as an XML file. Does anyone have a solution to this problem? Perlguy, did you have any luck with this?
Reply With Quote
  #4 (permalink)  
Old August 16th, 2011, 10:09 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

You need to change one of the method signatures in order for the data to persist. Since the introduction of iOS 4, and multitasking, the method

-(void)applicationWillTerminate:(UIApplication *)application

is rarely called since the application does not actually quit, but enters the background. In the AppDelegate method change this method signature to

-(void)applicationWillResignActive:(UIApplication *)application

The full listing would be

Code:
-(void)applicationWillResignActive:(UIApplication *)application
{
    NSLog(@"Resigning active");

//- (void)applicationWillTerminate:(UIApplication *)application { ////This method is not being called and can be deleted
    // Serialize the rootViewController's surveyDataArray
    NSData *serializedData;
    NSString *error;
    
    serializedData = [NSPropertyListSerialization 
                      dataFromPropertyList:rootViewController.surveyDataArray
                      format:NSPropertyListXMLFormat_v1_0
                      errorDescription:&error];
    
    if (serializedData)
    {
        // Serialization was successful, write the data to the file system
        // Get an array of paths. 
        // (This function is carried over from the desktop)
        NSArray *documentDirectoryPath = 
            NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
                                                NSUserDomainMask, YES);
        NSString *docDir = [NSString stringWithFormat:@"%@/serialized.xml",
                            [documentDirectoryPath objectAtIndex:0]];
        
        [serializedData writeToFile:docDir atomically:YES];
    }
    else
    {
        // An error has occurred, log it
        NSLog(@"Error: %@",error);
    }
}

Assuming everything else is correct, the data should now be stored, and can be synced in iTunes
Bob
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Books on iPad johnzonie Forum and Wrox.com Feedback 9 October 28th, 2013 01:28 AM
Want iPad get iPhone traffic4biz BOOK: Beginning iPad Application Development 1 August 21st, 2010 04:42 PM
iPad development Yondaime User Groups - Other Developer User Groups 0 July 17th, 2010 02:33 AM
Why an iPad ebook that you cannot see on a iPad? csburris BOOK: Beginning iPad Application Development 2 July 7th, 2010 11:11 AM
Iphone to Ipad Development tips ipadboy1 BOOK: Beginning iPad Application Development 0 May 2nd, 2010 12:53 AM



All times are GMT -4. The time now is 12:25 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.