FBSDKAppLinkUtility.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2. //
  3. // You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
  4. // copy, modify, and distribute this software in source code or binary form for use
  5. // in connection with the web services and APIs provided by Facebook.
  6. //
  7. // As with any software that integrates with the Facebook platform, your use of
  8. // this software is subject to the Facebook Developer Principles and Policies
  9. // [http://developers.facebook.com/policy/]. This copyright notice shall be
  10. // included in all copies or substantial portions of the software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. #import <Foundation/Foundation.h>
  19. /**
  20. Describes the callback for fetchDeferredAppLink.
  21. @param url the url representing the deferred App Link
  22. @param error the error during the request, if any
  23. The url may also have a fb_click_time_utc query parameter that
  24. represents when the click occurred that caused the deferred App Link to be created.
  25. */
  26. typedef void (^FBSDKDeferredAppLinkHandler)(NSURL *url, NSError *error);
  27. /**
  28. Describes the callback for fetchOrganicDeferredAppLink.
  29. @param url the url representing the deferred App Link
  30. */
  31. typedef void (^FBSDKDeferredAppInviteHandler)(NSURL *url);
  32. /**
  33. Class containing App Links related utility methods.
  34. */
  35. @interface FBSDKAppLinkUtility : NSObject
  36. /**
  37. Call this method from the main thread to fetch deferred applink data if you use Mobile App
  38. Engagement Ads (https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement).
  39. This may require a network round trip. If successful, the handler is invoked with the link
  40. data (this will only return a valid URL once, and future calls will result in a nil URL
  41. value in the callback).
  42. @param handler the handler to be invoked if there is deferred App Link data
  43. The handler may contain an NSError instance to capture any errors. In the
  44. common case where there simply was no app link data, the NSError instance will be nil.
  45. This method should only be called from a location that occurs after any launching URL has
  46. been processed (e.g., you should call this method from your application delegate's
  47. applicationDidBecomeActive:).
  48. */
  49. + (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler;
  50. /**
  51. @warning This method is no longer available and will always return NO.
  52. */
  53. + (BOOL)fetchDeferredAppInvite:(FBSDKDeferredAppInviteHandler)handler
  54. DEPRECATED_MSG_ATTRIBUTE("This method is no longer available.");
  55. /*
  56. Call this method to fetch promotion code from the url, if it's present. This function
  57. requires Bolts framework.
  58. Note: This throws an exception if Bolts.framework is not linked. Add '[BFURL class]' in intialize method
  59. of your AppDelegate.
  60. @param url App Link url that was passed to the app.
  61. @return Promotion code string.
  62. Call this method to fetch App Invite Promotion Code from applink if present.
  63. This can be used to fetch the promotion code that was associated with the invite when it
  64. was created. This method should be called with the url from the openURL method.
  65. */
  66. + (NSString*)appInvitePromotionCodeFromURL:(NSURL*)url;
  67. @end