Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Sometime startup with nothing but blank screen #6

Closed
MaxZeng opened this Issue Nov 25, 2012 · 9 comments

Comments

Projects
None yet
3 participants

MaxZeng commented Nov 25, 2012

My codes runs fine with the initial version of PaperFoldMenuController, but after replaced with the latest version, sometime it startup with nothing but blank screen.

When I try to pause this app in Xcode debug window, it show that the callstack:

semaphore_wait_trap
NSOperation start
PaperFoldMenuController viewDidLoad

I guess this is because the viewDidLoadBlockOperation, which is newly introduced.

Owner

honcheng commented Nov 25, 2012

Hi flypigz,

Thanks. I'll check with the contributor what that does.

On 26 Nov, 2012 2:17 AM, flypigz wrote:

Owner

honcheng commented Nov 25, 2012

Are you using code or IB?

Contributor

lxcid commented Nov 26, 2012

Hi flypigz,

That was a code I introduced, it was meant to defer the setting of selectedIndex until viewDidLoad.

Could you share how you initialise the PaperFoldVC code?

Its weird that it got stuck there. I knew that this is running on a separate thread but on my test it doesn't seems to cause issue.

I'll try to send a fix for that today that make it run on the current thread.

MaxZeng commented Nov 26, 2012

I tried the demo many times, there is no such issue, I am not sure if this is because the demo view controller is too simple, and nothing to load.

Pure code, no IB. Here are my init codes.

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    // custom initialization
    [self setupDatabase];
    [self applyStylesheet];
    [self appStartup];

    self.window.backgroundColor = [UIColor blackColor];
    [self.window makeKeyAndVisible];
    return YES;
    }

#pragma mark
#pragma mark - Application's Startup
///////////////////////////////////////////////////////////////////////////////////////////////////

  • (void)appStartup {
    _menuController = [[MenuViewController alloc] initWithMenuWidth:200.0 numberOfFolds:3];
    [self.window setRootViewController:_menuController];

    StartupViewController *startupVC = [[StartupViewController alloc] init];
    UINavigationController *startupNav = [[UINavigationController alloc] initWithRootViewController:startupVC];

    ThemesSettingViewController *themesVC = [[ThemesSettingViewController alloc] init];
    UINavigationController *themesNav = [[UINavigationController alloc] initWithRootViewController:themesVC];

    SettingsViewController *settingsVC = [[SettingsViewController alloc] init];
    UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settingsVC];

    HelpViewController *helpVC = [[HelpViewController alloc] init];
    UINavigationController *helpNAV = [[UINavigationController alloc] initWithRootViewController:helpVC];

    NSMutableArray *viewControllers = [NSMutableArray arrayWithObjects:startupNav, themesNav, settingsNav, helpNAV, nil];
    [_menuController setViewControllers:viewControllers];
    }

Contributor

lxcid commented Nov 26, 2012

Give me about an hour. I made a minor change to the way I handles deferring of setting selected Index and see if it helps. :) Cheers!

Stan Chang Khin Boon
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, 26 November, 2012 at 11:06 AM, flypigz wrote:

I tried the demo many times, there is no such issue, I am not sure if this is because the demo view controller is too simple, and nothing to load.
Pure code, no IB. Here are my init codes.
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
// custom initialization
[self setupDatabase];
[self applyStylesheet];
[self appStartup];
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
return YES;
}
#pragma mark
#pragma mark - Application's Startup
///////////////////////////////////////////////////////////////////////////////////////////////////
(void)appStartup {
_menuController = [[MenuViewController alloc] initWithMenuWidth:200.0 numberOfFolds:3];
[self.window setRootViewController:_menuController];
StartupViewController *startupVC = [[StartupViewController alloc] init];
UINavigationController *startupNav = [[UINavigationController alloc] initWithRootViewController:startupVC];
ThemesSettingViewController *themesVC = [[ThemesSettingViewController alloc] init];
UINavigationController *themesNav = [[UINavigationController alloc] initWithRootViewController:themesVC];
SettingsViewController *settingsVC = [[SettingsViewController alloc] init];
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settingsVC];
HelpViewController *helpVC = [[HelpViewController alloc] init];
UINavigationController *helpNAV = [[UINavigationController alloc] initWithRootViewController:helpVC];
NSMutableArray *viewControllers = [NSMutableArray arrayWithObjects:startupNav, themesNav, settingsNav, helpNAV, nil];
[_menuController setViewControllers:viewControllers];
}


Reply to this email directly or view it on GitHub (#6 (comment)).

MaxZeng commented Nov 26, 2012

Hi, lxcid,

I think it is a good idea to let all init stuffs run on the current thread, I don't know the reason but I guess this should be the root cause.....Thank you.

Actually the initial version works fine, the only “issue” is that it do some view creation stuffs in the "- (id)initWithMenuWidth:(float)menuWidth numberOfFolds:(int)numberOfFolds" method. It is not elegant but it works.

Contributor

lxcid commented Nov 26, 2012

Yeah, I agree that I should not let init stuff run on main thread.

I was using the NSOperation addExecutionBlock. It was spinning threads if I use that method. I planning to just keep an array of blocks instead. Cheers!

Contributor

lxcid commented Nov 26, 2012

Hi flypigz, Could you try my latest pull request and see if it works for you?

honcheng added a commit that referenced this issue Nov 26, 2012

Merge pull request #7 from lxcid/master
Attempts to fix issue #6.

MaxZeng commented Nov 26, 2012

Hi, Lxcid and HonCheng,

:-) Works like a charm! Cheers!

Thank you for your quick fix!!

@MaxZeng MaxZeng closed this Nov 26, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment