CLCircularRegion Can’t use method initWithCenter - rubymotion

Im trying to use CLCircularRegion.alloc.initWithCenter but i get undefined method...the method is listed when i use .init + tab, i can't figure out why this is happening.
Another issue that i find out is that there is no radius= method, so when i do
c = CLCircularRegion.new
i have the c.radius (that by default is 0.0) but if i want to change this value i don't have any away to do that, there is no c.radius= method.
Any thoughts about what is happening here, or another way to inicialize a CLCircularRegion with radius?

I got the answer from the rubymotion forum...
center_coordinate = CLLocationCoordinate2D.new(0.0, 0.0)
CLCircularRegion.alloc.initWithCenter(center_coordinate, radius: 1000.0, identifier: 'SomeID')
The radius= issue is basically because it's a read only property, so there is no setter method.
You can find the post and answer here:
http://community.rubymotion.com/t/clcircularregion-cant-use-method-initwithcenter/715

Related

How to use an Ember.getOwner(this).lookup('application:main') result

As the title say, I have some problem understanding what does this call return.
This is how I am using it:
fetchEngines()
{
let object = Ember.getOwner(this).lookup('application:main').engines;
console.log(object);
}
And it return me something like that:
At this point, this is what I want, the list of all my ember-engines.
But I don't know how to use it. By that I mean, how do I fetch the name of each engine, what is object at this point, I can't find anything about it.
I have tried the forEach() method, but it returns me : object.forEach is not a function. I have also tried the Object.keys method, but it returned me undefined, maybe somebody can indicate me a doc or something, I don't understand at all what is it.
Good day to you and thank you for reading.
I will answer this. This is very simple, and I made a mistake. The Object.keys method work, I didn't know how to write it well.
This is the corrected version:
fetchEngines()
{
let object = Ember.getOwner(this).lookup('application:main').engines;
// This will properly show every key in your object
console.log(Object.keys(object));
// And if you want to enumerate it
let filledArray = [];
for (let key in object) {
if (object.hasOwnProperty(key))
filledArray.push(key);
}
// The object filledArray is now a perfectly manipulable object
}

Swift 3 - AWS iOS 'EXC_BAD_INSTRUCTION' Error

After converting over to Swift 3, my AWS iOS App now crashes when being run.
Has anyone seen anything similar after converting over to Swift 3?
Its crashing because you are doing a few things here:
trying to return a method call (which I don't think is possible - but I've never tried it)
application: didFinishLaunching should only ever return true because it's a boolean function as the name suggests. So the return value should be true. If you'd like to override application: didFinishLaunching you can declare that later in your AppDelegate
So here's what you can do... Try deleting the method and slowly type it back until Xcode auto-completes it for you. That will allow you to see what has been depreciated, or what other methods might be useful, also if you haven't yet hit Command + Shift + K to run a clean on your project. Xcode 8 and Swift 3 might have altered a few more things you aren't aware of.
launchOptions is an optional parameter. Doing a forced unwrap with the ! will crash if the value is nil, which it usually is.

Modifying ATriggerSphere radius?

I've created an instance of ATriggerSphere in my game, and placed it at my character's location, like so:
//Create activate trigger radius
activateRadiusTrigger = GetWorld()->SpawnActor<ATriggerSphere>(ATriggerSphere::StaticClass(),GetActorLocation(), GetActorRotation());
activateRadiusTrigger->SetActorHiddenInGame(false);
I need to adjust its radius now. I see that in blueprints there's a parameter under Shape that lets me change the value of "Sphere Radius", but I can't find the C++ equivalent field. Can someone tell me how that's done? Thanks!
If you look up TriggerSphere.h in the engine headers, you can find its public interface there. It looks like ATriggerSphere uses a collision component that you can get using GetCollisionComponent(). I'm going to assume this component is a USphereComponent, and you can call SetSphereRadius on that!
so try:
Cast<USphereComponent>(activateRadiusTrigger->GetCollisionComponent())->SetSphereRadius(NewRadius);

Gtk::ScaleButton: Icons in the constructor

I am trying to use a Gtk::ScaleButton in Gtkmm 3. My problem is the constructor. It needs as last parameter (see here: https://developer.gnome.org/gtkmm/stable/classGtk_1_1ScaleButton.html#a96753b6cb6b8adb0ed3727ba3eb8cfb7 ) a vector of ustrings. I guess (i can't find it in the docs what it means exactly) i have to give it the path to the +/- Images. I want to use the Gtk Stock items for +/-. How can i achieve this?
Currently i give it an empty vector, which results in a glibmm warning:
std::vector<Glib::ustring> icons;
Gtk::ScaleButton * scale = Gtk::manage(new Gtk::ScaleButton(Gtk::ICON_SIZE_SMALL_TOOLBAR, 0.0, 10.0, 1.0, icons));
Warning:
glibmm-WARNING **: Glib::ConstructParams::ConstructParams(): object class "gtkmm__GtkScaleButton" has no property named "min"
How can i avoid the warning and give it stock icons?
You must be one of the first people to ever try using this Gtk::ScaleButton constructor from gtkmm. It seems to have been broken for several years.
I've fixed it in gtkmm: https://git.gnome.org/browse/gtkmm/commit/?id=26f94d231da9481d74acdd94e56168ed6b38609a
But it will be some time until that is widely available via Linux distro packages. In the meantime you can try using
Gtk::ScaleButton* button = Glib::wrap(gtk_scale_button_new(whatever));
See https://developer.gnome.org/gtkmm-tutorial/stable/sec-basics-gobj-and-wrap.html.en
However, I don't know how it's actually meant to behave, so you might encounter other bugs. You might actually want to use the derived Gtk::VolumeButton instead.
andlabs is correct that the GTK+ documentation describes the icons better:
https://developer.gnome.org/gtk3/stable/GtkScaleButton.html#GtkScaleButton--icons
and those should indeed probably be the standard icon names:
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

ADBannerView delegate methods never triggering

Question is as simple as the tip of the question.
banner is working in test mode in device.(seems like so: "You re connected to the iAd Network").
declared -didFailToReceiveAdWithError, -bannerViewDidLoadAd and -bannerViewActionShouldBegin.
and ADBannverView1.delegate assigned to self (is a cocos2d CCLayer)
but these methods never called. I drop some breakpoints that never runs into.
have you any idea ?
Question 2: what is the difference between these property definations ? should I use weak, assign ? or IBOutlet is a necessarry ?I tried all 3 combination and all worked.
#property(nonatomic,retain) ADBannerView *iAdView;
#property(nonatomic,retain) IBOutlet ADBannerView *iAdView;
#property(nonatomic,assign) ADBannerView *iAdView;
For me the problem was that I also had this line in my code self.canDisplayBannerAds=YES;
After I removed it delegate method were called properly.