Search code examples
iphoneobjective-ciosxcodetapku

Not being able to add Tapku library into XCode 4.2 project


I tried following this tutorial from the author's github repository, but unsuccessfully. When I try to build the project I get 6 errors.

5 of them are

Use of undeclared identifier '_accessibleElements'

and 1 of them is

Receiver type 'TKCalendarMonthTiles' for instance message does not declare a method with selector 'rectForCellAtIndex'

All errors are reported inside TKCalendarMonthView.m file


Solution

  • It appears the class TKCalendarMonthTiles declares a property:

    @property (nonatomic, strong) NSMutableArray *accessibleElements;
    

    which is not synthesized in the class implementation. Since no _accessibleElements ivar is declared, then you get the undeclared identifier error that you mention.

    For this error, you can either build on Xcode 4.4 to autosynthesize declared properties, or add:

    @synthesize accessibleElements = _accessibleElements
    

    in the TKCalendarMonthTiles implementation

    Now, for your second error. This is also due to building on Xcode 4.2 instead of 4.4. As of 4.4 (or maybe 4.3, I can't recall) you do not need to declare private methods in a class extension. But since you are building with Xcode 4.2, you will need to add the method declaration to a class extension on TKCalendarMonthTiles

    @interface TKCalendarMonthTiles ()
    - (CGRect)rectForCellAtIndex:(int)index;
    @end