rubymotion

rubymotion Cannot find executable for CFBundle

一笑奈何 提交于 2019-12-11 08:42:21
问题 I just installed RubyMotion on my iMac. I created my first app - Hello This is the code: class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.rootViewController = HelloViewController.alloc.init @window.rootViewController.wantsFullScreenLayout = true @window.makeKeyAndVisible true end end I run $ Rake and the IOS Simulator start up. And I get this error: 2014-04-25 18:58:03.157

How to set iOS UITextField placeholder color? (RubyMotion + iOS)

可紊 提交于 2019-12-11 06:04:36
问题 How to use RubyMotion to set a textField's placeholder text foreground color? Example code: textField = UITextField.alloc.init textField.placeholder = "Hello World" The placeholder text shows up gray; I want it to be red. This is using RubyMotion, not Objective-C. 回答1: Use an attributed string like this: self.attributedPlaceholder = NSAttributedString.alloc.initWithString( self.placeholder || "Hello World", attributes: {NSForegroundColorAttributeName => UIColor.redColor} ) This works on iOS7,

Selecting the iOS Simulator device type with RubyMotion

拥有回忆 提交于 2019-12-10 04:10:00
问题 Since iOS 8 was released the default device type for simulator became iPhone 6. And even if I manually change the device type using Hardware > Device menu, on the next launch (using rake simulator ) the simulator will revert to iPhone 6. I wonder if there is any rake options, or some other settings to force the device type. PS. I know that there are ways to force a non-retina iPhone and a way to launch the iPad simulator instead of the iPhone one, but I'm interested in selecting between 5/6/6

How do I use Magical Record to create & update objects and save them without using contextForCurrentThread

蓝咒 提交于 2019-12-08 17:03:37
问题 I just read the author of MagicalRecord's blog post on Why contextForCurrentThread Doesn't work in MagicalRecord. contextForCurrentThread is deprecated and saveWithBlock should be used instead because it creates a safe new NSManagedObjectContext for the relevant thread. I've been using contextForCurrentThread extensively in my app so far. However, I'm having trouble figuring out how to use saveWithBlock instead as my fetching and saving are not necessarily happening sequentially. Currently I

RubyMotion async programming with BubbleWrap

天大地大妈咪最大 提交于 2019-12-06 06:23:37
I am confused with how to write decent code when using a lot of asynchronous code. In the following code snippet I log in to get the authentication cookie and use that cookie for the next request to get a list of projects name (as an example): def self.populateProjectsTable(projects_controller) payload = {email: "email", password: "pass"} HTTP.post("http://example.com/login", {payload: payload}) do |response| authCookie = response.headers['Set-Cookie'] HTTP.get("http://example.com/projects.json", {cookie: authCookie}) do |response| projects = JSON.parse(response.body.to_str) projects

How to pass parameters via the selector/action?

蓝咒 提交于 2019-12-06 05:51:33
问题 Is there a way to pass parameters via the addTarget call as it calls another function? I've also tried the sender method - but that seems to break as well. What's the correct way to pass the parameters without creating global variables? @my_button = UIButton.buttonWithType(UIButtonTypeRoundedRect) @my_button.frame = [[110,180],[100,37]] @my_button.setTitle("Press Me", forState:UIControlStateNormal) @my_button.setTitle("Impressive!", forState:UIControlStateHighlighted) # events newtext =

Include not finding module RubyMotion

爱⌒轻易说出口 提交于 2019-12-05 16:39:09
Are mixins allowed in RubyMotion? I have a directory with two files. One is a class, the other a module. When I include the module (mixin) in my class, I get a not found error. Everything under app is automatically required in RM right? Thanks for any help. Found it! http://dylanmarkow.com/blog/2012/05/06/load-order-with-rubymotion/ I'm using Bundler, so I ended up putting something like this in the Motion::Project::App.setup do |app| block: app_files = app.files.reverse.pop app.files << Dir.glob(File.join(app.project_dir, 'lib/**/*.rb')) << app_files There is definitely a better way to do

Selecting the iOS Simulator device type with RubyMotion

半城伤御伤魂 提交于 2019-12-05 05:36:12
Since iOS 8 was released the default device type for simulator became iPhone 6. And even if I manually change the device type using Hardware > Device menu, on the next launch (using rake simulator ) the simulator will revert to iPhone 6. I wonder if there is any rake options, or some other settings to force the device type. PS. I know that there are ways to force a non-retina iPhone and a way to launch the iPad simulator instead of the iPhone one, but I'm interested in selecting between 5/6/6+. Thanks zhulinpinyu Run /Applications/Xcode.app/Contents/Developer/usr/bin/simctl list (or

Apple rejected app because it's transmitting MAC Address without user permission

我的未来我决定 提交于 2019-12-04 23:17:48
问题 We had a recently developed app rejected by Apple. Here is their explanation: We found your app does not obtain user consent before collecting the user's personal data, as required by theApp Store Review Guidelines. Specifically, your applications sends the device's MAC address without the user's permission. Your app also sends device Contact information without the user's permission. To collect personal data with your app, you must make it clear to the user that their personal data will be

How to pass parameters via the selector/action?

佐手、 提交于 2019-12-04 09:59:19
Is there a way to pass parameters via the addTarget call as it calls another function? I've also tried the sender method - but that seems to break as well. What's the correct way to pass the parameters without creating global variables? @my_button = UIButton.buttonWithType(UIButtonTypeRoundedRect) @my_button.frame = [[110,180],[100,37]] @my_button.setTitle("Press Me", forState:UIControlStateNormal) @my_button.setTitle("Impressive!", forState:UIControlStateHighlighted) # events newtext = "hello world" @my_button.addTarget(self, action:'buttonIsPressed(newtext)', forControlEvents