rubymotion

Rubymotion / bubblewrap geolocation in airplane mode makes the app crash

为君一笑 提交于 2019-12-22 00:33:25
问题 Trying to get an clean geoloc implementation in some app; quite struggling with the limitations of what bubblewrap provide for locations def get_location begin BW::Location.get_once do |location| if location self.latitude = location.latitude self.longitude = location.longitude end end rescue puts "can't geoloc" end end With this code (sorry bu I show the 'tests' that - i expect - would work as fallbacks with ruby code), I just get a plain app crash if i set the airplane mode on the phone

Better autocomplete in VIM

邮差的信 提交于 2019-12-20 20:37:49
问题 All, I have been working with vim for some time now, and love everything about it - there is only one thing I really miss from IDEs like RubyMine, and that is advanced autocompletion. For reference, here is my standard VIM setup: https://github.com/wrwright/.vim I have tried ctags with omnicomplete + supertab, and the one major element I miss is the ability to bring up a context sensitive list of attributes/constants/methods. For example, as I learn RubyMotion, I'd love to have some help

Better autocomplete in VIM

扶醉桌前 提交于 2019-12-20 20:37:23
问题 All, I have been working with vim for some time now, and love everything about it - there is only one thing I really miss from IDEs like RubyMine, and that is advanced autocompletion. For reference, here is my standard VIM setup: https://github.com/wrwright/.vim I have tried ctags with omnicomplete + supertab, and the one major element I miss is the ability to bring up a context sensitive list of attributes/constants/methods. For example, as I learn RubyMotion, I'd love to have some help

AFNetworking with request error code 999

我的梦境 提交于 2019-12-18 04:39:30
问题 I'm new to objective-c and i'm having a hard time with a AFNetworking. So the thing is that i want to make a simple POST request to a server who will send me back a salt. I'v make a simple app, in order to test my request but i don't understand why i'm getting the error code 999. Here a sample of my code. + (void)simpleRequest; { NSURL *mailserver = [NSURL URLWithString:@"https://localhost:4443/"]; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc]initWithBaseURL:mailserver];

How can I track the current number of viewers of an item?

风流意气都作罢 提交于 2019-12-13 06:26:54
问题 I have an iPhone app, where I want to show how many people are currently viewing an item as such: I'm doing that by running this transaction when people enter a view (Rubymotion code below, but functions exactly like the Firebase iOS SDK): listing_reference[:listings][self.id][:viewing_amount].transaction do |data| data.value = data.value.to_i + 1 FTransactionResult.successWithValue(data) end And when they exit the view: listing_reference[:listings][self.id][:viewing_amount].transaction do

Object initialization in RubyMotion

本秂侑毒 提交于 2019-12-13 04:25:42
问题 I am new to RubyMotion and trying to understand how object initialization works. Suppose a simple class with one class and one instance method: class Something def self.getSomething BubbleWrap::HTTP.post("http://example.com") do |response| p response end end def getSomething BubbleWrap::HTTP.post("http://example.com") do |response| p response end end end Now, why does the following work: Something.getSomething And the next snippet not, well, sometimes (ran this snippet and the runtime crashed

MacRuby Pointer to typedef struct

≡放荡痞女 提交于 2019-12-13 03:41:52
问题 this code fails with Semgentation Fault: 11, and I can't understand why framework 'Cocoa' framework 'CoreFoundation' framework 'Security' * keychainObject = Pointer.new_with_type('^{OpaqueSecKeychainRef}') SecKeychainOpen("/Users/charbon/Library/Keychains/Josja.keychain",keychainObject) SecKeychainLock(keychainObject) I'm sure it has to do with the keychainObject type, because this works (it locks the default keychain). SecKeychainLock(nil) I'm using the '^{OpaqueSecKeychainRef}' as the type

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

别等时光非礼了梦想. 提交于 2019-12-13 01:11:28
问题 How to use RubyMotion to set a textField border color? Example code: textField = UITextField.alloc.init textField.borderStyle = UITextBorderStyleLine The border color shows up as the Apple default color; I want it to be red. This is using RubyMotion, not Objective-C 回答1: Use the Quartz framework. In your Rakefile: app.frameworks << 'QuartzCore' To set the layer attributes: textField.layer.borderColor = UIColor.redColor.CGColor textField.layer.borderWidth = 1 textField.layer.masksToBounds =

RubyMotion reload sections of UITableView

岁酱吖の 提交于 2019-12-12 03:46:28
问题 How can I reload specific section of a table? [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade] How can I write something like this in ruby's syntax? 回答1: Here it is in RubyMotion syntax: sections = NSIndexSet.indexSetWithIndex(indexPath.section) self.tableView.reloadSections sections, withRowAnimation:UITableViewRowAnimationFade 来源: https://stackoverflow.com/questions/15587095/rubymotion-reload-sections-of

How to change state images for tabbar items?

孤街醉人 提交于 2019-12-11 15:55:44
问题 I am building a Rubymotion app and I am customizing the tabBar. I have managed to put a custom image as a background of the tabBar but now I need to set individual images to each tab. One for when it is pressed and one for when it is not. I am following the guide (for objective-c) at NSScreencasts.com and the show notes says I should use this code. But when I try it in Ruby (which I think is correct) I get an error. In Objective-C: - (id)initWithCoder:(NSCoder *)aDecoder { self = [super