Created
August 29, 2012 03:35
-
-
Save dmarkow/3506545 to your computer and use it in GitHub Desktop.
Broken performSelector:withObject:afterDelay in RubyMotion 1.22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
test_perform_selector | |
true | |
end | |
def test_perform_selector | |
foo = "bar" | |
foo.retain # Crashes without this | |
wait_1_second do | |
puts foo | |
foo.release # Crashes without this | |
end | |
end | |
def wait_1_second(&block) | |
performSelector("run_block:", withObject:block, afterDelay:1.0) | |
end | |
def run_block(block) | |
block.call | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment