Comments (16)
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.
c.dependency 'handlebars-objc', '~> 1.0.1'
from handlebars-objc.
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.
Thanks! If you could comment on this thread when you've done that, that would be great.
from handlebars-objc.
I just pushed v1.3.0. Could you try this one?
from handlebars-objc.
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.
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.
"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.
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.
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.
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.
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.
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.
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.
Any chance you could recreate the issue in a simple project you could share with me?
from handlebars-objc.
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)
- Changing scope from 'this' HOT 2
- Erroneous documentation on valid context objects? HOT 5
- Bison/yacc error when using Cocoapods 0.35 HOT 3
- Difficulty creating helper
- ARC restriction errors even with -fno-objc-arc HOT 30
- Build fails with Xcode 9.3 HOT 3
- Parsing without escaping embedded text... is it possible? HOT 4
- Difficulty writing a specific type of helper HOT 3
- Lex error when including `inhibit_all_warnings!` in Podfile HOT 3
- Will handlebars-objc loop through an NSSet? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-objc.