FBSettings.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. * Copyright 2010-present Facebook.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <CoreGraphics/CGBase.h>
  18. #import "FBSDKMacros.h"
  19. /*
  20. * Constants defining logging behavior. Use with <[FBSettings setLoggingBehavior]>.
  21. */
  22. /*! Log requests from FBRequest* classes */
  23. FBSDK_EXTERN NSString *const FBLoggingBehaviorFBRequests;
  24. /*! Log requests from FBURLConnection* classes */
  25. FBSDK_EXTERN NSString *const FBLoggingBehaviorFBURLConnections;
  26. /*! Include access token in logging. */
  27. FBSDK_EXTERN NSString *const FBLoggingBehaviorAccessTokens;
  28. /*! Log session state transitions. */
  29. FBSDK_EXTERN NSString *const FBLoggingBehaviorSessionStateTransitions;
  30. /*! Log performance characteristics */
  31. FBSDK_EXTERN NSString *const FBLoggingBehaviorPerformanceCharacteristics;
  32. /*! Log FBAppEvents interactions */
  33. FBSDK_EXTERN NSString *const FBLoggingBehaviorAppEvents;
  34. /*! Log Informational occurrences */
  35. FBSDK_EXTERN NSString *const FBLoggingBehaviorInformational;
  36. /*! Log cache errors. */
  37. FBSDK_EXTERN NSString *const FBLoggingBehaviorCacheErrors;
  38. /*! Log errors likely to be preventable by the developer. This is in the default set of enabled logging behaviors. */
  39. FBSDK_EXTERN NSString *const FBLoggingBehaviorDeveloperErrors;
  40. /*!
  41. @typedef
  42. @abstract A list of beta features that can be enabled for the SDK. Beta features are for evaluation only,
  43. and are therefore only enabled for DEBUG builds. Beta features should not be enabled
  44. in release builds.
  45. */
  46. typedef NS_ENUM(NSUInteger, FBBetaFeatures) {
  47. FBBetaFeaturesNone = 0,
  48. #if defined(DEBUG) || defined(FB_BUILD_ONLY)
  49. FBBetaFeaturesLikeButton = 1 << 2,
  50. #endif
  51. };
  52. /*!
  53. @typedef
  54. @abstract Indicates if this app should be restricted
  55. */
  56. typedef NS_ENUM(NSUInteger, FBRestrictedTreatment) {
  57. /*! The default treatment indicating the app is not restricted. */
  58. FBRestrictedTreatmentNO = 0,
  59. /*! Indicates the app is restricted. */
  60. FBRestrictedTreatmentYES = 1
  61. };
  62. /*!
  63. @class FBSettings
  64. @abstract Allows configuration of SDK behavior.
  65. */
  66. @interface FBSettings : NSObject
  67. /*!
  68. @method
  69. @abstract Retrieve the current iOS SDK version.
  70. */
  71. + (NSString *)sdkVersion;
  72. /*!
  73. @method
  74. @abstract Retrieve the current iOS SDK version.
  75. */
  76. + (void)setSDKVersion:(NSString*)version;
  77. /*!
  78. @method
  79. @abstract Retrieve the current Facebook SDK logging behavior.
  80. */
  81. + (NSSet *)loggingBehavior;
  82. /*!
  83. @method
  84. @abstract Set the current Facebook SDK logging behavior. This should consist of strings defined as
  85. constants with FBLogBehavior*, and can be constructed with, e.g., [NSSet initWithObjects:].
  86. @param loggingBehavior A set of strings indicating what information should be logged. If nil is provided, the logging
  87. behavior is reset to the default set of enabled behaviors. Set in an empty set in order to disable all logging.
  88. */
  89. + (void)setLoggingBehavior:(NSSet *)loggingBehavior;
  90. /*!
  91. @method
  92. @abstract
  93. This method is deprecated -- App Events favors using bundle identifiers to this.
  94. */
  95. + (NSString *)appVersion __attribute__ ((deprecated("App Events favors use of bundle identifiers for version identification.")));
  96. /*!
  97. @method
  98. @abstract
  99. This method is deprecated -- App Events favors using bundle identifiers to this.
  100. */
  101. + (void)setAppVersion:(NSString *)appVersion __attribute__ ((deprecated("App Events favors use of bundle identifiers for version identification.")));
  102. /*!
  103. @method
  104. @abstract Retrieve the Client Token that has been set via [FBSettings setClientToken]
  105. */
  106. + (NSString *)clientToken;
  107. /*!
  108. @method
  109. @abstract Sets the Client Token for the Facebook App. This is needed for certain API calls when made anonymously,
  110. without a user-based Session.
  111. @param clientToken The Facebook App's "client token", which, for a given appid can be found in the Security
  112. section of the Advanced tab of the Facebook App settings found at <https://developers.facebook.com/apps/[your-app-id]>
  113. */
  114. + (void)setClientToken:(NSString *)clientToken;
  115. /*!
  116. @method
  117. @abstract Set the default Facebook Display Name to be used by the SDK. This should match
  118. the Display Name that has been set for the app with the corresponding Facebook App ID, in
  119. the Facebook App Dashboard
  120. @param displayName The default Facebook Display Name to be used by the SDK.
  121. */
  122. + (void)setDefaultDisplayName:(NSString *)displayName;
  123. /*!
  124. @method
  125. @abstract Get the default Facebook Display Name used by the SDK. If not explicitly
  126. set, the default will be read from the application's plist.
  127. */
  128. + (NSString *)defaultDisplayName;
  129. /*!
  130. @method
  131. @abstract Set the default Facebook App ID to use for sessions. The SDK allows the appID
  132. to be overridden per instance in certain cases (e.g. per instance of FBSession)
  133. @param appID The default Facebook App ID to be used by the SDK.
  134. */
  135. + (void)setDefaultAppID:(NSString *)appID;
  136. /*!
  137. @method
  138. @abstract Get the default Facebook App ID used by the SDK. If not explicitly
  139. set, the default will be read from the application's plist. The SDK allows the appID
  140. to be overridden per instance in certain cases (e.g. per instance of FBSession)
  141. */
  142. + (NSString *)defaultAppID;
  143. /*!
  144. @method
  145. @abstract Set the default url scheme suffix used by the SDK.
  146. @param urlSchemeSuffix The default url scheme suffix to be used by the SDK.
  147. */
  148. + (void)setDefaultUrlSchemeSuffix:(NSString *)urlSchemeSuffix;
  149. /*!
  150. @method
  151. @abstract Get the default url scheme suffix used for sessions. If not
  152. explicitly set, the default will be read from the application's plist value for 'FacebookUrlSchemeSuffix'.
  153. */
  154. + (NSString *)defaultUrlSchemeSuffix;
  155. /*!
  156. @method
  157. @abstract Set the bundle name from the SDK will try and load overrides of images and text
  158. @param bundleName The name of the bundle (MyFBBundle).
  159. */
  160. + (void)setResourceBundleName:(NSString *)bundleName;
  161. /*!
  162. @method
  163. @abstract Get the name of the bundle to override the SDK images and text
  164. */
  165. + (NSString *)resourceBundleName;
  166. /*!
  167. @method
  168. @abstract Set the subpart of the facebook domain (e.g. @"beta") so that requests will be sent to graph.beta.facebook.com
  169. @param facebookDomainPart The domain part to be inserted into facebook.com
  170. */
  171. + (void)setFacebookDomainPart:(NSString *)facebookDomainPart;
  172. /*!
  173. @method
  174. @abstract Get the Facebook domain part
  175. */
  176. + (NSString *)facebookDomainPart;
  177. /*!
  178. @method
  179. @abstract Enables the specified beta features. Beta features are for evaluation only,
  180. and are therefore only enabled for debug builds. Beta features should not be enabled
  181. in release builds.
  182. @param betaFeatures The beta features to enable (expects a bitwise OR of FBBetaFeatures)
  183. */
  184. + (void)enableBetaFeatures:(NSUInteger)betaFeatures;
  185. /*!
  186. @method
  187. @abstract Enables a beta feature. Beta features are for evaluation only,
  188. and are therefore only enabled for debug builds. Beta features should not be enabled
  189. in release builds.
  190. @param betaFeature The beta feature to enable.
  191. */
  192. + (void)enableBetaFeature:(FBBetaFeatures)betaFeature;
  193. /*!
  194. @method
  195. @abstract Disables a beta feature.
  196. @param betaFeature The beta feature to disable.
  197. */
  198. + (void)disableBetaFeature:(FBBetaFeatures)betaFeature;
  199. /*!
  200. @method
  201. @abstract Determines whether a beta feature is enabled or not.
  202. @param betaFeature The beta feature to check.
  203. @return YES if the beta feature is enabled, NO if not.
  204. */
  205. + (BOOL)isBetaFeatureEnabled:(FBBetaFeatures)betaFeature;
  206. /*!
  207. @method
  208. @abstract
  209. Gets whether data such as that generated through FBAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches.
  210. */
  211. + (BOOL)limitEventAndDataUsage;
  212. /*!
  213. @method
  214. @abstract
  215. Sets whether data such as that generated through FBAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches.
  216. @param limitEventAndDataUsage The desired value.
  217. */
  218. + (void)setLimitEventAndDataUsage:(BOOL)limitEventAndDataUsage;
  219. /*!
  220. @method
  221. @abstract Returns YES if the legacy Graph API mode is enabled
  222. */
  223. + (BOOL)isPlatformCompatibilityEnabled;
  224. /*!
  225. @method
  226. @abstract Configures the SDK to use the legacy platform.
  227. @param enable indicates whether to use the legacy mode
  228. @discussion Setting this flag has several effects:
  229. - FBRequests will target v1.0 of the Graph API.
  230. - Login will use the prior behavior without abilities to decline permission.
  231. - Specific new features such as `FBLikeButton` that require the current platform
  232. will not work.
  233. */
  234. + (void)enablePlatformCompatibility:(BOOL)enable;
  235. @end