The mac simulator wont show onscreen


#1

So my app compiles correctly. There are no errors and everything is linked correctly in IB. The NSLog reports no errors, but nothing appears on screen. Does anyone know why? my Macbook pro is plugged into another monitor so im using two screens but nothing except xcode is visible onscreen.


#2

I get the same problem TahDoodle is running but I don’t see the Window. I’ve created the application twice and its the same in both? I’m sure its a simple setting I’ve missed…


#3

Does the menu come up? (If there is a menu, but no document window, you might have broken a connection between your BNRDocument and the window object in BNRDocument.xib.)


#4

Hi, yes the menu appears. There are no errors or warnings either. Both connections are in place in the .h file :

[code]#import <Cocoa/Cocoa.h>

@interface BNRDocument : NSDocument
{
NSMutableArray *todoItems;
IBOutlet NSTableView *itemTableView;
}

  • (IBAction)createNewItem:(id)sender;

@end

[/code]

above has the correct circles and black dot.

and in the .m file the following has the same:


- (IBAction)createNewItem:(id)sender
{
    // if there's no array yet, go ahead and create one to store our new task
    if (!todoItems) {
        todoItems = [NSMutableArray array];
    }
    [todoItems addObject:@"New Item"];
    
    // -reloadData tells the table view refresh and ask its dataSource
    // (which happens to be this BNRDocument object in this case)
    // for new data to display
    [itemTableView reloadData];
    
    // -updateChangeCount: tells the application whether or not the document
    // has unsaved changes.  NSChangeDone flags the document unsaved.
    [self updateChangeCount:NSChangeDone];
}

#5

How do you add a grab image to this?


#6

I have this working now by starting again from scratch for the third time.

Question: Is the order of connections of importance?

On thing I did notice was when trying to connect I could not connect Files Owner to Table View and I could only see Window. The reason for this was BNRDocument.h was like this:

#import <Cocoa/Cocoa.h>

@interface BNRDocument : NSDocument <NSTableViewDataSource>
{
    NSMutableArray *todoItems;
    IBOutlet NSTab  *itemTableView;
}
- (IBAction)createNewItem:(id)sender;

@end

instead of this:

#import <Cocoa/Cocoa.h>

@interface BNRDocument : NSDocument <NSTableViewDataSource>
{
    NSMutableArray *todoItems;
    IBOutlet NSTableView  *itemTableView;
}
- (IBAction)createNewItem:(id)sender;

@end

I think initially I modified the code after trying to connect and made some error.

QUESTION: The spinning wheel runs continuously while running is this correct?


#7

The order of connections is not important, but they must all be connected before you build.

No, the wait cursor (the spinning wheel) should not be present when the program is running. This indicates that the application is not pulling events off the event queue quickly enough – your program may be in an infinite loop.

Stop it in the debugger and inspect the stack to see what is running.


#8

In xcode 4.4, to access the auto-size controls, you have to turn auto-layout off in the File Inspector attributes. As soon as this is turned off, things get buggy and the application starts as minimized. No idea why, but I haven’t spent a ton of time digging into it. If everything about your app seems fine when you launch, and you’re seeing the TahDoodle menu bar, it’s worth looking in your dock to see if the main window is hiding down there. On a test project, I was able to get it to launch maximized by checking on the Window objects “Visible at Launch” attribute. However, this does not seem to help on the TahDoodle project.


#9

I have the same problem, but it definitely worked until I tried to add ‘the big missing feature’ - saving and reading the list. I just edited method ‘dataOfType’ as per the book, and it refused to appear. The crazy thing is that I commented the code back to exactly the way it was before, and it still won’t appear.

Just solved it - all you need to do is use the TahDoodle menu to ‘File / New’ and it will create a new document window for you.

This was probably obvious to all you Mac experts, but as a Windows programmer, I hadn’t even noticed that the menu had changed from Xcode to TahDoodle. Note that there were also code errors in the file read and save methods, but these were already corrected in my Kindle edition - they may still exist if you’re reading the old school paper version. (See topic Quirks, bugs with TahDoodle)