groue / GRMustache

Flexible and production-ready Mustache templates for MacOS Cocoa and iOS
http://mustache.github.com/
MIT License
1.44k stars 190 forks source link

Fix Warnings #68

Closed RyanCopley closed 10 years ago

RyanCopley commented 10 years ago

Hi,

Could you please fix the warnings in this project? Two of them can be suppressed (properly) with

(GRMustacheNSUndefinedKeyExceptionGuard +swizzleIfNeeded

+ (void)swizzleIfNeeded
{
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wundeclared-selector"
    
        static BOOL needsSwizzle = YES;
        if (needsSwizzle) {
            [NSObject jr_swizzleMethod:@selector(valueForUndefinedKey:)
                        withMethod:@selector(GRMustacheSilentValueForUndefinedKey_NSObject:)
                             error:nil];

        Class NSManagedObjectClass = NSClassFromString(@"NSManagedObject");
        if (NSManagedObjectClass) {
            [NSManagedObjectClass jr_swizzleMethod:@selector(valueForUndefinedKey:)
                                     withMethod:@selector(GRMustacheSilentValueForUndefinedKey_NSManagedObject:)
                                             error:nil];
        }

        needsSwizzle = NO;
    }

    #pragma clang diagnostic pop
}

The other two are in regards to renderVariable: being deprecated, but I do not see any new API for it. Could you remove deprecated functions from the in-use code base or apply preprocessor guards so they don't cause warnings?

Thanks, Ryan

RyanCopley commented 10 years ago

Also, updating Cocoapods after applying this would be an extra +1 :)

groue commented 10 years ago

Hi. I'm on vacation right now. I will not consider this issue in the next two weeks.

RyanCopley commented 10 years ago

It's been roughly 2 weeks, could we begin some discussion about these warnings?

groue commented 10 years ago

Hi.

Here is how I understand your situation:

  1. You are using GRMustache v5.x, and its code base generates warnings in the most recent version of Xcode.
  2. You are using the renderVariable: method which has been eventually deprecated, then replaced by a new set of APIs in v6.x.

On the 1st issue, the warnings generated by v5.x, I won't do anything. I recommend you upgrade to the latest version: v6.9.1. You'll get bug fixes, performance improvements, and other stuff you'll discover in the release notes.

On your 2nd issue, I understand your trouble: I did not clearly document how to upgrade from v5 to v6. So let's address it here, in the comments of this issue. Explain me how you are using the renderVariable: method, and I'll help you migrating to v6 APIs.

If my understanding is correct, and if you agree with my proposal, please tell me. I would also rename the issue "How to migrate from v5 to v6".

RyanCopley commented 10 years ago

Well, this is absolutely disappointing :( This isn't your fault or mine, actually. I'm using a library called RMMapBox and their repository links to GRMustache v5.4.3. I'll ask them to update to the latest version of mustache if possible.

groue commented 10 years ago

Don't be disappointed. GRMustache has long been well-tested, and those warnings are not the signs of any bugs.