I've setup Apple Pay in my app, and after reading the documentation, it says not to just use a .png for the 'Pay with Apple Pay' button, but rather to use their documentation code to show the button (as then, it is exactly to spec). I can't seem to find the code for the Pay With Apple Pay button (obj-c) anywhere?
As mentioned in the documentation
https://developer.apple.com/library/archive/ApplePay_Guide/CreateRequest.html#//apple_ref/doc/uid/TP40014764-CH3-SW2
To create an Apple Pay–branded button for initiating payment request
on iOS 8.3 or later, use the PKPaymentButton class
ref:
https://developer.apple.com/documentation/passkit/pkpaymentbutton
e.g.
PKPaymentButton *button = [PKPaymentButton buttonWithType: PKPaymentButtonTypePlain style:PKPaymentButtonStyleBlack];
Related
Searching Apple Pay / Passkit / Wallet documentation, I've found very few code examples and pretty poor documentation. We're attempting to present a payment pass we've provisioned rather than just launch the wallet with openPaymentSetup().
According to PKPassLibrary docs, this can be achieved with PKPassLibrary.present(). We're invoking this function and it launches Apple Pay directly into the add a card wizard, which seems worse than the UX from openPaymentSetup().
The code we're using is:
let library: PKPassLibrary = PKPassLibrary()
let passes: [PKPass] = library.remotePaymentPasses()
if !passes.isEmpty, #available(iOS 10.0, *) {
library.present(passes[passes.count-1].paymentPass!)
} else {
library.openPaymentSetup()
}
We get the pass library and our passes, then conditionally attempt to present the last pass.
Does anyone know how to show a pass rather than launching a tutorial or add a card wizard?
You can still use presentPaymentPass api to present a PaymentPass. But your iOS version should be >=10.3.3 even if Apple Documentation says iOS version > 10.0. This is a wrong documentation from Apple.
I created a Twitter and Facebook SHARE buttons. However, I don't know if i'm allowed to use the official Twitter bird logo and the official Facebook F logo as a custom image button on my app. Are developers allowed to do that or are we supposed to get permission from Facebook and Twitter? Or should I just create a custom button that says Facebook, Twitter on it? I've seen only official facebook and twitter logos on game apps and other apps. How is it done?
Both Facebook and Twitter have strict guidelines for that, which you can find on their corresponding developer sites. You will also find the necessary resources (i.e. images) on these sites. It is typically not ok to use custom images.
That said, the official guides are not always followed and personally I have never heard of anyone being held responsible for doing it wrong. But I would strongly encourage you to follow them in any case.
At least for Facebook, I would always advise to use the official SDK and the Share Button it provided. You can read more here: https://developers.facebook.com/docs/sharing/ios#triggering
FBSDKShareButton *button = [[FBSDKShareButton alloc] init];
button.shareContent = content;
[self.view addSubview:button];
As Instagram official document says
To include a pre-filled caption with your photo, you can set the annotation property on the document interaction request to an NSDictionary containing an NSString under the key "InstagramCaption". Note: this feature will be available on Instagram 2.1 and later.
For Instagram 4.x or lower, it works well. But for Instagram 5.0, Instagram team added a new feature called "Direct". When users upload a photo, they have two options "Followers" or "DIRECT". I think this is the reason why "InstagramCaption" doesn't work. Is there a new way to add caption programmatically?
Thank you so much!
self.dic.annotation = #{#"InstagramCaption" : captionString};
self.dic.delegate = self;
[self.dic presentOpenInMenuFromRect:shareButton.frame inView:self.view animated:YES];
It doesn't work now.
Best response I've gotten so far:
Thanks for your report and interest in the Instagram platform. We are aware of this issue and it will be fixed in the next update of the iOS app.
I followed up asking for a timeframe or anymore info on a workaround but have not heard anything.
This is fixed in Instagram Version 5.0.1.
It appears that they have removed the caption url parameter from their URL scheme though. So UIDocumentInteractionController can still pass a caption through the annotation property but trying to add one through the URL scheme is no longer supported.
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.
I would like to know whether it is possible to add a Facebook Like button to a native iPhone app. In the app, the user browses a business directory or deals. When they tap on an item to view the details, it would be nice to have a Facebook Like button that can be used to post the item to the user's Facebook page.
Facebook writes: "Currently, the Like button is only available in mobile web apps".
My app is a native app and not a web app, so therefore I assume it's not possible. However, I do assume that it is possible to mix native UI components on a screen along with web components and therefore it might be possible to implement the Like button, although I am not sure how you pass data from the native portion to the web portion.
If the only solution is a hack, then I won't implement it because at some point the hack will fail when Facebook alters their API.
read around SO a little, you get many leads. Here's one:
Like button in iOS application
And a comment points to github.com/brow/FacebookLikeView
It has same caveats, but it seems there aren't any magic solutions.
There are these blogposts as well:
http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html
http://petersteinberger.com/2010/06/add-facebook-like-button-with-facebook-connect-iphone-sdk/
But not sure you get a native UIButton. Maybe you can open a webview in the background and emulate a click on it...
GL, update if you have some findings,
Oded.
Now you can use the FBlike button using the following code but it need to download latest sdk and it is the beta version :(
Here is the code:
[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];
FBLikeControl *like = [[FBLikeControl alloc] init];
like.objectID = #"http://shareitexampleapp.parseapp.com/photo1/";
like.likeControlHorizontalAlignment=FBLikeControlHorizontalAlignmentRight;
like.likeControlStyle=FBLikeControlStyleBoxCount;
[self.view addSubview like];
It looks like Facebook finally decided to allow this, more directly, via the Open Graph API.
See documentation here
Check this out, FB just made it possible through their SDK. Only for testing and ios for now
https://developers.facebook.com/docs/ios/like-button/