Kernel's sprintf / format / % method broken in apps #4

Closed
timbogit opened this Issue May 8, 2012 · 5 comments

Comments

Projects
None yet
4 participants
@timbogit

timbogit commented May 8, 2012

While trying to run the Timer sample app, I discovered that Kernel#sprintf is broken:
--- snip ---

tim-schmelmers-macbook:Timer tim$ rake
(in /Users/tim/ruby_motion/RubyMotionSamples/Timer)
Build ./build/iPhoneSimulator-5.1-Development
Compile ./app/timer_controller.rb
Link ./build/iPhoneSimulator-5.1-Development/Timer.app/Timer
Create ./build/iPhoneSimulator-5.1-Development/Timer.dSYM
Simulate ./build/iPhoneSimulator-5.1-Development/Timer.app
(main)>> res = "%.1f" % 0.2123
=> "%.1f"
(main)>> res = sprintf("%.1f",0.2123)
=> "%.1f"
(main)>> res = format("%.1f",0.2123)
=> "%.1f"
(main)>>
--- snap ---

This seems to work with the ruby interpreter that comes with Ruby Motion, though ...
--- snip ---
tim-schmelmers-macbook:~ tim$ /Library/RubyMotion/bin/ruby -e 'puts format("%.1f",0.2123)'
0.2
--- snap ---

@dmarkow

This comment has been minimized.

Show comment Hide comment
@dmarkow

dmarkow May 8, 2012

Confirmed. I'm 99% sure this worked fine in RubyMotion 1.0, though I can't check now that I've updgraded. Now, whenever I try to use sprintf or NSString.stringWithFormat, I get unexpected results. I filed an official support ticket as well.

dmarkow commented May 8, 2012

Confirmed. I'm 99% sure this worked fine in RubyMotion 1.0, though I can't check now that I've updgraded. Now, whenever I try to use sprintf or NSString.stringWithFormat, I get unexpected results. I filed an official support ticket as well.

@lrz

This comment has been minimized.

Show comment Hide comment
@lrz

lrz May 8, 2012

Member

A fix for this problem will ship in tonight's build (if there is one) or tomorrow. Sorry about the inconvenience.

Member

lrz commented May 8, 2012

A fix for this problem will ship in tonight's build (if there is one) or tomorrow. Sorry about the inconvenience.

@lrz

This comment has been minimized.

Show comment Hide comment
@lrz

lrz May 9, 2012

Member

Should be fixed by RubyMotion 1.3

Member

lrz commented May 9, 2012

Should be fixed by RubyMotion 1.3

@lrz lrz closed this May 9, 2012

@timbogit

This comment has been minimized.

Show comment Hide comment
@timbogit

timbogit May 10, 2012

confirmed fixed, thanks for the quick action!

confirmed fixed, thanks for the quick action!

@mmmries

This comment has been minimized.

Show comment Hide comment
@mmmries

mmmries Dec 31, 2012

Hey Guys, I think this is not totally fixed. I have an app that is using sprintf to fill in some labels, but when I use sprintf my simulator (motion 1.30, OS 10.7.5) throws a ton of "pointer being freed was not allocated" messages and if I try to run on my device (iPad mini iOS 6.0.2) the app crashes outright. If I replace sprintf with just a hardcoded string it runs with no errors on the simulator and on the device.

Any ideas on what might be going on?

mmmries commented Dec 31, 2012

Hey Guys, I think this is not totally fixed. I have an app that is using sprintf to fill in some labels, but when I use sprintf my simulator (motion 1.30, OS 10.7.5) throws a ton of "pointer being freed was not allocated" messages and if I try to run on my device (iPad mini iOS 6.0.2) the app crashes outright. If I replace sprintf with just a hardcoded string it runs with no errors on the simulator and on the device.

Any ideas on what might be going on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment