Disabling Siri in an app - objective-c

Is there any way to completely disable Siri within the app? I am not only talking about the proximity sensor, but the long-press on the home key as well.
Thanks.

No. It's impossible to override the functionality of the home button. In general, Apple does not allow you to modify the behavior of something that is outside of the scope of your app.

Related

Is there a way to programatically toggle vibrate?

In objective-c for iOS dev, is there any way to programatically toggle the vibrate on/off? And also to check its current state?
If there is, where might I find it in documentation? I've looked and cannot find it so maybe it's not possible?
Edit: I don't mean to make the phone vibrate. What I mean is that when the phone is on silent there is a toggle to have vibration on/off. Can this be controlled programatically?
No you can't.
This is a system defined property (that your user can access from Settings).
None of the iOS APIs allow such kind of control.

Siri on Custom keyboard App Extension iOS 8

Currently I am working on a iOS 8 custom keyboard extension and I want to mimic the functionality of Siri similar to the default keyboard.
Can we able to use Siri on iOS 8 Custom keyboard App extension? If we can is there any API/documentation available?
Thanks
Custom keyboard is an app extension, so it cannot access to the microphone. And without microphone, we cannot do something like Siri does.
I think we have to wait until Apple changes!
Custom keyboards, like all app extensions in iOS 8.0, have no access to the **device microphone**, so dictation input is not possible.
From: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
No, native Siri access is not yet possible. You can use something like Nuance ndev to produce this functionality though. http://dragonmobile.nuancemobiledeveloper.com
You should be able to switch back and forth using the globe key so the user will have quick access to the native keyboard in the case they need to dictate.

How do you hide the menu bar in a Cocoa app?

How do you programmatically hide the menu bar in a cocoa app? I would like to make full use of the screen area.
There are two good ways I know of to do this.
1
In Cocoa, you can call the NSMenu class method setMenuBarVisible: to show or hide the menu bar.
As of this writing, the documentation for the NSMenu class does not tell you the following additional information.
The menu bar will only be hidden for the app that calls this method.
The Dock will also be hidden at the same time.
(This is true at least in 10.9 and I have not tested any other versions.)
This is useful when you want to use an app in a full screen way where you have a cover window, a borderless window the size of the screen.
The nice feature of this (as opposed to playing with LSUIElement settings) is that your app can continue to be in the application switcher cycling, as well as visible in the Dock when other apps are active.
This allows users to still activate a full screen app through the Dock or application switcher.
That means you can still use your app's Dock menu to access a preferences window for your app or other features.
This is incredibly convenient if your app is indeed a full screen cover window that runs at a window level higher than other apps, but you still want to make preferences and the ability to quit your app available, and you want your app's visual functionality available when other apps are active.
2
Another option is via NSApplication's method setPresentationOptions: with the arguments from NSApplicationPresentationOptions enum, such as option NSApplicationPresentationHideMenuBar
With this approach be very wary of reading the documentation, although it gives you additional options, and is still app-specific only, you need to know that some of the options are mutually exclusive. There are rules you must follow, or you get nothing but exceptions spewed to the console.
3 There is a 3rd and crappy option. If you have a helper app that is a daemon, you can use it to change your app's LSUIElement state and basically relaunch your app. It's dumb and it takes you out of the app switcher completely, which is great if you really are writing something that should not be there, but that is rare.
There is also the NSView enterFullScreenMode:withOptions: method, although most apps for which that would be appropriate prior to 10.7 should probably use the modern full-screen-window API on 10.7 and later.

Polling the keyboard in Cocoa

My Cocoa application should react continuously to the state of the keys pressed by the user. To that end, I would like to poll the keyboard at fixed intervals, instead of relying on keyboard events. Is there any Cocoa API to achieve this? If not, what other options exist?
Polling is never such a great idea. You shouldn't have to do that in most cases.
There is 2 API you may be interested for:
Quartz Event Taps https://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
IOKit HID API https://developer.apple.com/library/mac/#documentation/DeviceDrivers/Conceptual/HID/intro/intro.html#//apple_ref/doc/uid/TP40000970
Please note keyboard accesses may pose some security issues so the system may not allow you to read the keyboard state. Check the Accessibility settings (access to assistive devices).
Don't poll the keyboard, just implement -keydown: in your App delegate class.

Cocoa Touch how to design the interface like facebook iPhone application's home screen?

I am just curious how facebook for iPhone application can display a list of icons with the text, then all the icons shake to allow user to change the position of each item.
What kind of control is that, and is there some sample code that do the same thing?
I think it must be standard because it exists as well in home screen of iPhone and iPod app to choose the tab item.
Thank you.
It's not a standard control. It's generally implemented with Core Animation and a rotation transform.
Apple discourages App developers from imitating the spring board, claiming it is confusing for the user. So don't expect standard controls for this.
You can of course implement it yourself with animation. Basic (property based) animation should be sufficient.