UITableViewDataSource build error

Discussion in 'Mac Programming' started by Enuratique, Jun 24, 2008.

  1. macrumors 6502

    Joined:
    Apr 28, 2008
    #1
    Yet another problem guys. I'm so close to finishing but I'm getting a build error when I try to override the cellForRowAtIndexPath delegate method. I'm just doing what is done in UIShowcase AS WELL AS The TableViewSuite examples.

    Code:
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
    if (cell == nil) {
      cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reusableIdentifer:@"MyIdentifier"] autorelease];
    // set text of cell
    }
    
    The build error I get is related to the CGRectZero:

    Building target “WordsterAssistant” of project “WordsterAssistant” with configuration “Debug” — (1 error)

    Undefined symbols:
    "_CGRectZero", referenced from:
    _CGRectZero$non_lazy_ptr in WordsterAssistantDataSource.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    "_CGRectZero", referenced from:
    _CGRectZero$non_lazy_ptr in WordsterAssistantDataSource.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    Build failed (1 error)

    I double checked to make sure I was including all the Framework header files that the example sources included but I'm stumped. Any ideas?

    This object's interface is defined as
    Code:
    @interface WordsterAssistantDataSource : NSObject <UITableViewDataSource>
    
    Do I also need to have this object implement the UITableViewDelegate protocol as well? I don't need any of its functionality.
     
  2. macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #2
    Are you sure you have CoreGraphics.framework added to the project AND the target checkbox checked so that its actually linked in?
     
  3. thread starter macrumors 6502

    Joined:
    Apr 28, 2008
    #3
    That was the problem! Thanks yet again!
     
  4. macrumors newbie

    Joined:
    Apr 4, 2008
    #4
    Same Issue

    I've got my app working in iPhone Simulator but when I go to device/debug I'm getting the _CGRectZero lazy pointer error. I'm still learning Xcode. What TARGET box is supposed to be checked. I haven't found it yet.

    -dB
     
  5. macrumors newbie

    Joined:
    Jun 25, 2007
    #5
    Targets

    Click on Frameworks under Groups & Files pane in the XCode project window. One of the columns on the right side will look like a bullseye, and there should be checkboxes under them. Make sure the CoreGraphics one is checked.
     
  6. macrumors newbie

    Joined:
    Apr 4, 2008
  7. macrumors newbie

    Joined:
    Jul 23, 2008
    #7
    I have the box checked and I am still having the same problem??
     
  8. macrumors newbie

    Joined:
    Apr 4, 2008
    #8
    CGRectZero Workaround

    I got my app to work by replacing the reference to CGRectZero with CGRectMake(0,0,0,0)

    Then later I discovered that I had only aparently loaded some of the required libraries by dragging and dropping them from one project to another rather than using the add new files function. When I added the necessary frameworks the "correct" way then my app started recognizing CGRectZero properly.

    CGRectMake(0,0,0,0) was reported in one of the threads I read as equivalent to CGRectZero

    YMMV but it worked for me.

    -dB
     
  9. macrumors newbie

    Joined:
    Jul 23, 2008
    #9
    Thanks, this fixes the just find and replace CGRectZero with CGRectMake(0,0,0,0) and it will compile and run.

    Still, I think as iPhoneczar points out, I may have done the drag & drop too and that may have been the problem.

    Thanks for the tips:)!!
     

Share This Page