Git Product home page Git Product logo

Comments (16)

Bertrand avatar Bertrand commented on July 22, 2024

Hello,

can you tell me what version of handlebars-objc you are using and how you include it in your app (pod file, binary dist, source include?)

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

c.dependency 'handlebars-objc', '~> 1.0.1'

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Ok, I think your issue has been fixed but is not available in a pod yet.
I'll try to submit a new pod later today.
Sorry for the inconvenience.

-- bertrand.

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

Thanks! If you could comment on this thread when you've done that, that would be great.

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

I just pushed v1.3.0. Could you try this one?

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

Hi,

It throws this error:

Arc forbids Objective-C objects in struct

on this code

   typedef struct HBParserIntegerValue HBParserIntegerValue;
    struct HBParserIntegerValue {
        int value;
        NSString* source;
    };

If I comment out the NSString, my app works, but several of my unit tests don't.

Sorry, forgot to mention that yes, the memory leaks are gone, with the exception of one, in

HBObjectPropertyAccess:objectiveCPropertyNamesForClass: 

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Any chance you could give me an example of unit test that throws when you don't comment the line?

I suspect an issue with cocoapod build settings in arc-based apps.

Le Jun 18, 2014 Γ  3:57, Exotic Objects [email protected] a Γ©crit :

Hi,

It throws this error:

`Arc forbids Objective-C objects in struct'

on this code

typedef struct HBParserIntegerValue HBParserIntegerValue;
struct HBParserIntegerValue {
int value;
NSString* source;
};
If I comment out the NSString, my app works, but several of my unit tests don't.

β€”
Reply to this email directly or view it on GitHub.

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

"I suspect an issue with cocoapod build settings in arc-based apps."

Meaning that you'll need to adjust your podspec? Ideally, people using ARC wouldn't have to do anything special to use your lib - everyone uses ARC!

Regarding unit tests, a few fail, but they're all related to the same helper, which worked fine in previous version. And again, I can only test with the NSString in the struct in HBParserIntegerValue commented OUT, as the app won't compile with it in. Here's the helper:

    HBHelperBlock sentenceCaseBlock = ^(HBHelperCallingInfo * callingInfo) {
        NSString * locale = assignString(callingInfo[@"locale"], defaultLocale);
        NSString * src = callingInfo[0];
        return [src capitalizedStringWithLocale:[[NSLocale alloc] initWithLocaleIdentifier:locale]];
    };
    [HBHandlebars registerHelperBlock:sentenceCaseBlock forName:@"sentenceCase"];

Here's the test that uses it:

NSError * error;
NSString * result =
        [HBHandlebars renderTemplateString:@"hello {{sentenceCase locale='en_US' value}}!"
                               withContext:@{@"value" : @"mike this is your friend george"}
                                     error:&error];

And here's the error that Handlebars reports:

    syntax error, unexpected CLOSE, expecting EQUALS
    line -1610612736
    'enceCase locale='en_US' value}}'
    2014-06-17 22:45:41.953 Capture[55385:70b] 
    ERROR thrown in DEBUG mode.:

     {
      "HBLineNumberKey" : -1610612736,
      "HBPositionInBufferKey" : 42,
      "HBParserLowLevelDescriptionKey" : "syntax error, unexpected CLOSE, expecting EQUALS",
      "HBContextInBufferKey" : "enceCase locale='en_US' value}}"
    } 

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Hello,

thanks for the test. Will try to reproduce today.

Of course, you are right, you should absolutely use ARC in your app.

I was just mentioning that I need to investigate possible issues with cocoapods build process since I myself use handlebars-objc in an ARC-enabled app without problem (but I don't use cocoapods to link against handlebars).

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Ok, so you are facing several issues at once.

Failing Tests

As stated in handlebars.js documentation, "Handlebars helpers can also receive an optional sequence of key-value pairs as their final parameter".

The grammar in handlebars-objc 1.3 has been modified and now enforces the placement constraints to avoid incompatibilities with the JS version.

In your templates, hash parameters should be moved after positional parameters. Your test template should thus be:

{{sentenceCase value locale='en_US'}}

Unfortunately, you have to update all your templates. Sorry for the inconvenience :(

Incompatibilities with ARC

There is a test project in src/non-unit-tests/test-embedding-in-projects/Test OSX CocoaPods that I use to test cocoapod integration. The application is a normal ARC-enabled application using handlebars-objc pod, and it compiles and runs fine.

Since I'm not able to reproduce your compilation issue, I'm not sure how I can really be of any help.

At this point, I think you have to create a project that you can share with me that exhibits the issue.

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Hello ExoticObjects,

I'm still trying to figure out why you have those build issues.
Can you confirm you do not include any handlebars-objc private headers?

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

Ok, I can't get to this until next week. If I can recreate the issue in a simpler project, I will send it to you.

As far as I can tell, though, HBParserIntegerValue.source is never used, so commenting it out does no harm. Could be wrong, but 'find in files' reveals no uses...

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Ok, thanks for getting back to me. Do you import any header other than <HBHandlebars/HBHandlebars.h> ?

On Jun 19, 2014, at 7:19 PM, Exotic Objects [email protected] wrote:

Ok, I can't get to this until next week. If I can recreate the issue in a simpler project, I will send it to you.

As far as I can tell, though, HBParserIntegerValue.source is never used, so commenting it out does no harm. Could be wrong, but 'find in files' reveals no uses...

β€”
Reply to this email directly or view it on GitHub.

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

Sorry I never replied on this. Got busy and forgot...

I only use handlebars via cocoapods, so whatever is being imported in that case is what I import.

I use a vanilla cocoapods implementation:

c.dependency 'handlebars-objc', '~> 1.3.0'

Hopefully that helps.

from handlebars-objc.

Bertrand avatar Bertrand commented on July 22, 2024

Any chance you could recreate the issue in a simple project you could share with me?

from handlebars-objc.

ExoticObjects avatar ExoticObjects commented on July 22, 2024

I just made a barebones project and, you're right, no problem. So it's got to be something with my project, which is very elaborate... I'll look into the potential header issue you mention above.

from handlebars-objc.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.