I have been trying to find a way to hide other applications programmaticly in my AppDelegate. I tried:
func hide() {
NSLog("hide")
NSApplication.hideOtherApplications(self)
}
The error seems to be in the "self". I am pretty sure it is a really simple error but I keep on having issues trying to work it out.
But this does not seem to work. I am new to OS X programming. Although I already worked a bit (just a little bit) with swift.
I guess you are looking for this:
NSWorkspace.sharedWorkspace().hideOtherApplications()
NSApplication.sharedApplication().hideOtherApplications(self)
NSApplication.sharedApplication().unhideAllApplications(self)
There is no unhideAllApplications for NSWorkspace. Please check the reference from Apple website.
Related
All of a sudden, I get a warning on the code used to initialize the Google Mobile Ads SDK. (It had been working for weeks before with no warning, but now it seems there's a new way to write the code.)
This is the code I have:
GADMobileAds.configure(withApplicationID: "ca-app-pub-################~##########")
But it gives me this warning: 'configure(withApplicationID:)' is deprecated: Use [GADMobileAds.sharedInstance startWithCompletionHandler:]
I've tried to rewrite it like this (with and without the square brackets):
GADMobileAds.sharedInstance startWithCompletionHandler: "ca-app-pub-################~##########"
But it just gives me an error that it expected a ;.
How should I write this? Thank you!
1) Add the follow in Info.plist
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
2) in AppDelegate
GADMobileAds.sharedInstance().start(completionHandler: nil)
Thank you Sr, it worked for me on Xamarin, just I need it to make some little changes on the code as follow:
GADMobileAds.SharedInstance.Start(completionHandler: null)
I am executing my protractor code on MAC OS system and using Chrome. Everything works but not drag and drop event.
The code is working fine if I put my actual mouse position on the target of drop. But if the actual mouse position is not at the target location, its not performing the action.
The code I am using is as:
browser.actions().dragAndDrop(source,target).perform();
I have also tried this :
browser.actions().mouseDown(source).mouseMove(target).mouseUp().perform();
Use html-dnd NPM module.
Link:https://www.npmjs.com/package/html-dnd
code snippet:
var dragAndDrop = require('html-dnd').code;
var draggable = driver.findElement(By.id('draggable'));
var droppable = driver.findElement(By.id('droppable'));
driver.executeScript(dragAndDrop, draggable, droppable);
for this :
browser.actions().dragAndDrop(source,target).perform();
try this :
browser.actions().mouseMove(source).mouseDown().mouseMove(target).mouseUp().perform();
Note that dragAndDrop is nothing but mouseMove + mouseDown + mouseMove + mouseUp
Chances are you're in a long line of people who have problems with the drag and drop functionality implemented with html5. This has been a problem area to work around using Selenium webdriver.
Please see that the issue might be due to an age old bug that was filed for ChromeDriver.
The bug has a lot of discussion that may be helpful in understanding the real issue and there are also a lot of solutions mentioned in the comments below - however there has not been a fool-proof or 100% working solution to this problem.
This bug has been mentioned in Protractor github issues a lot of times like here, here, here,and here and in Selenium GitHub in the archived issues here.
One of the solutions you can try is this helper method that was created here. However this is not a guaranteed solution, but I would suggest you to give it a try. The original issue mentioned for Protractor here also has many other solutions mentioned which you can try. You can also try this helper method.
Also, please see that the same question has been posted multiple times here, here, here, here.
I'm trying to implement the OpenTok SDK into Nativescript and I've run into an issue that I can't seem to wrap my head around.
Per their documentation (https://tokbox.com/developer/guides/publish-stream/ios/#create_publisher) once you create a publisher object you call:
[self.view addSubview:publisher.view];
I can't figure out how I would tie this into Nativescript, if it's even possible.
My first thought is that I would want a UIView or View element on my page in the XML, then I would call .addView(publisher.view); on that element.
There is a similar question here (Inject pure Java / Obj-C code in NativeScript App) but nothing came of it, the one answer does't provide much help.
I cloned one of OpenTok's sample projects and added their implementation of this call into a gist here: https://gist.github.com/bondydaa/2db355ed45b7e50e4071
You can see at line 117 how they implemented this call. This code raises another question for me in that I'm not sure where _publisherView comes from.
Any help would be greatly appreciated!
In Nativescript you can try calling the 'ios' property of the container you are trying to add the component to. This will return the native object.
For example if you have a StackLayout, you can:
var stackLayout = args.object.getViewById("theIdOfTheStackLayout");
stackLayout.ios.addSubview(publisher.view);
I am making a Cocoa app, and previously, all my code was in AppDelegate.swift. I wanted to write an extension but it wouldn't let me do it there, so I created another class, and pasted my code in it. After reconnecting all my objects to their respective Xibs (sorry if my technical jargon is a bit off) the code is the exact same except for the initialization. I used
func applicationDidFinishLaunching(aNotification: NSNotification)
which worked previously in AppDelegate.Swift but now no longer gets executed. Is there a reason for this?
Well it turns out I just needed to add a delegate from my new class to AppDelegate.swift. Now at least the launching works, but now unfortunately everything I write there is crashing. Oh well.
I did not understand well what your problem is, anyway you could follow these steps:
Create your class (suppose to be a UIViewController)
Connect your class with a ViewController in your main storyboard (make sure your app uses that storyboard in Project Settings)
To get started with your code use methods like viewDidLoad, viewDidAppear and so on, which are triggered automatically, like didFinishLaunchingWithOptions you used before.
This problem is almost certainly gonna have a really simple answer, but I just can't see it. I'm programming an app for the iPhone in Xcode and I'm trying to create an instance of an ABPerson object, but can't. In my .h file, I am importing as follows:
#import <AddressBook/AddressBook.h>
#import <AddressBook/ABPerson.h>
Then when I try to create it using "ABPerson *person;", it gives the error, "Unknown type name 'ABPerson'".
I have searched the internet and there doesn't seem to be much on the use of ABPerson and where I have seen it used, they have done it like this and its worked fine.
Ultimately, I want to create a VCard containing the details of somebody which the user can then save to their phone so if you know of another way of doing this which would eliminate this problem, that would also be great.
Thanks,
Matthew
Have you added the AddressBook framework to your app? Look in XCode4, look at your project file -> Build Phases -> Link Binary with Libraries.
Try this.
#import <AddressBook/AddressBook.h>
#import <AddressBook/ABAddressBook.h>