Wrox Programmer Forums
|
BOOK: Beginning iOS 4 Application Development
This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2011, 02:05 PM
Registered User
 
Join Date: May 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 4 Tab Bar Application

I am experiencing a persistent crash with the Book's code. This happened in my build after Step 6, page 129. I then opened the book's project, set the base SDK to 4.2. Then double-clicked the MainWindow.xib and have three alert windows open with Assertion Failure: Show Details, Crash, Continue.

Thoughts?
 
Old February 21st, 2011, 05:08 PM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default I have the same issue

I am able to follow the instructions on pages 126 through 129. I am able to run the application successfully. However, as soon as I close the MainWindow.xib and reopen it, I get an error from interface builder. I am no longer able to edit the MainWindow.xib in interface builder.

However, I am still able to run the application.
 
Old February 22nd, 2011, 01:41 PM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

This may seem rather bizarre, but try this.
Redo the code, but don't add the badge to the Search tab item.
Again, I don't have this book, but the project appears to be identical to the one in the author's previous book. That code was fine back in August, when I did the project, but now has the same issues. The downloaded code can be made to work by deleting the MainWindow.xib then setting it up again (Add File>New File>User Interface>Application XIB, add the Tab Bar Controller make the necessary changes (setting nibs etc) and connections, save and Build & Run). The program, Xcode and Interface Builder can be quit. The project can be reopened edited etc, as long as the badge is not added. Once the badge is added, the assertion failure will occur if the file is closed then reopened in Interface Builder. Fortunately the badge is just window dressing and can added in code if wanted.
Let me know if this solves the problem for you.
Bob

addendum:
add the following to the appDelegate to display the badge and avoid the assertion failure

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.
	NSArray *controllerList = [tabBarController viewControllers];
	[[[controllerList objectAtIndex:2] tabBarItem] setBadgeValue:@"5"];

    // Add the tab bar controller's view to the window and display.
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];

    return YES;
}
or more encapsulated

In the appDelegate

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.
	NSArray *controllerList = [tabBarController viewControllers];
	
	[[controllerList objectAtIndex:2] initWithNibName:nil bundle:nil];

    // Add the tab bar controller's view to the window and display.
	
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];

    return YES;
}
and in SearchViewController.m

Code:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [[self tabBarItem] setBadgeValue:@"5"];
    }
    return self;
}

Last edited by thepianoguy; February 23rd, 2011 at 01:12 AM..
 
Old March 15th, 2011, 01:44 AM
Registered User
 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Found this issue as well

I came across this issue as well and after much fighting (and before I found these posts) I figured out that it was the badge setting causing the assertion failure in IB. Does anyone know if this was determined to be a result of a bug in IB / XCode or anything? I'm wondering if this has been reported so it might be addressed in the future (although I don't see why you'd want to set badge values as defaults in IB like this and would normally do it through code anyway). Frustrating to fight through it like this but that is how you learn I suppose.
 
Old March 15th, 2011, 07:30 AM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

I think the crash reports go to Apple, so they would be made aware of the problem in this manner. Also, for what it is worth, the program can be opened and edited as written in Xcode 4, so what ever was causing the assertion failure has been resolved.

Bob





Similar Threads
Thread Thread Starter Forum Replies Last Post
VC++ MFC application not scrolling correctly on tab movement muchala123 C# 4.0 aka C# 2010 General Discussion 0 December 22nd, 2010 01:43 AM
Ch 14 Tool Bar Buttons bkelly BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 0 November 25th, 2010 02:29 PM
Tab Bar Application starting at page 185 iPhoneNoob BOOK: Beginning iPhone SDK Programming with Objective-C 0 July 26th, 2010 12:05 PM
Manifest Editor - Application tab shows empty page sunrain BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 6 January 21st, 2009 04:42 PM
how to create tab control in web application vino_gayathri ASP.NET 1.0 and 1.1 Basics 1 February 20th, 2007 05:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.