How are iOS7 Keyboard Shortcuts Implemented? - ios

I saw this MacStories article about some apps adding keyboard shortcuts to iOS7 apps. How is this implemented? Is it a private API that I shouldn't be using?
I've done some searching around the iOS developer library on http://developer.apple.com, but I couldn't find anything.

There's already a SO question for this. See this answer and this blog post for details.
Basically, there is a new keyCommands property on the UIResponder class in iOS7. Override the getter to return an array of UIKeyCommands.
Hat tip to Сергей Малетин for the comment.

Related

What is the equvalent of "OnUserInteraction" in iOS

I want to know if there is any android "OnUserInteraction" equvalent in iOS. I want to implement session logout functionality so I need to know any equvalent functionality fo OnUserInteraction.
In iOS you can subclass UIApplication and override SendEvent as outlined here.

iOS SDK: Custom open graph story with "Feelings"

I'm successfully publishing a custom Open Graph story, with a custom FBSDKShareOpenGraphAction and a custom FBSDKShareOpenGraphObject.
However, I can't find the documentation for assigning a "feeling" to the story. There are a few questions here on SO but the answers say it's not possible, although the Runtastic iOS app does it (see the "feeling awesome" part):
I'm not using the standard Share Dialog (FBSDKShareDialog) but am implementing my own custom interface as advised in their docs
Has anyone had any success with this? Any thoughts/ideas are greatly appreciated.

Check programmatically if contact allows FaceTime in Objective-C or Swift

Just like the title states, I am working on contacts app. What I would like to know is if there is a way for me to find out if the contacts are reachable through FaceTime? Is there a public API for it? (Note: Solutions like ChatKit.framework for iMessage are not really acceptable, i.e. private APIs)
UPDATE: found a post here, that partially answers the question: FaceTime programmatically
UPDATE #2: using #"//facetime:" scheme does not seem to work at all, as I always get true in return
UIApplication.sharedApplication().canOpenURL(NSURL(string: "facetime://0000000000")!)

Is UIPageControl customization legal?

I've found out that it's very easy to customize UIPageControl page images (I've checked it for iOS7/8):
[self setValue:[UIImage imageNamed:#"my_icon_for_off_state"] forKey:#"_pageImage"];
[self setValue:[UIImage imageNamed:#"my_icon_for_on_state"] forKey:#"_currentPageImage"];
But I wonder can I publish my app with this code, because these variables are declared as private in UIPageControl?
As per Apple, you can't use private API's in your project.
However we can. Don't worry. Just be honest and while submitting the app, inform them that you have used xyz code.
Apple DON'T approve the app where insecure private API's are used.
Many times, I used private API's and Apple approved it.
Honesty is simplicity.
One of the example
As you've already stated, those properties are declared private by Apple so you will be unable to use them. You can change the tint color of the page "dots" by using pageIndicatorTintColor and currentPageIndicatorTintColor.

UIBarButtonItem nextResponder call

Looking on the web (https://github.com/Musixmatchdev/ObjectiveHeaders/blob/master/Headers/iPhoneOS6.0.sdk/UIKit/UIBarButtonItem.h) I found that UIBarButtonItem is implemented nextResponder selector.
However that's not part of the public API of UIBarButtonItem but it is in UIResponder class (which sadly UIBarButtonItem does not inherit from).
Am I authorized to use it or could it be refused by Apple ? (I would have asked on Apple Forums but it's gonna be down for a while I believe :)
Thanks a lot,
Jack Pardshe
Sadly, UIBarButtonItem is based on crippled UIBarItem, and neither of them implements nextResponder method. So, it's considered a private (non-public) API, and according to Apple App Store review guideline pt.2.5, "Apps that use non-public APIs will be rejected".
Note: Apple Developer portal is down now, but one can easily find the guide on the net
P.S. Please describe the reason of using nextResponder of UIBarButtonItem - I'm sure there are more than one way to achieve it.
Ok I found a solution for my specific issue:
I forward calls to [[UIApplication sharedApplication] sendAction:to:from:forEvent:]] selector which in turn (with the from parameter) uses UIBarButtonItem nextResponder. So this is an indirect reference to it using public API.
However I think that Apple is just using a respondsToSelector:#selector(nextResponder) on an id parameter in this method. So doing the same thing inside a custom code (write a method which take an id parameter and then call nextResponder on it) might also be a solution to use nextResponder selector whithout being seen as using the private API but this is just an hypothesis.

Resources