commit | author | age
|
2e29a3
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
NS_ASSUME_NONNULL_BEGIN |
|
12 |
|
|
13 |
/** |
|
14 |
The error domain for all errors from FBSDKCoreKit. |
|
15 |
|
|
16 |
Error codes from the SDK in the range 0-99 are reserved for this domain. |
|
17 |
*/ |
|
18 |
FOUNDATION_EXPORT NSErrorDomain const FBSDKErrorDomain |
|
19 |
NS_SWIFT_NAME(ErrorDomain); |
|
20 |
|
|
21 |
/* |
|
22 |
@methodgroup error userInfo keys |
|
23 |
*/ |
|
24 |
|
|
25 |
/** |
|
26 |
The userInfo key for the invalid collection for errors with FBSDKErrorInvalidArgument. |
|
27 |
|
|
28 |
If the invalid argument is a collection, the collection can be found with this key and the individual |
|
29 |
invalid item can be found with FBSDKErrorArgumentValueKey. |
|
30 |
*/ |
|
31 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentCollectionKey |
|
32 |
NS_SWIFT_NAME(ErrorArgumentCollectionKey); |
|
33 |
|
e0ec42
|
34 |
/// The userInfo key for the invalid argument name for errors with FBSDKErrorInvalidArgument. |
2e29a3
|
35 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentNameKey |
L |
36 |
NS_SWIFT_NAME(ErrorArgumentNameKey); |
|
37 |
|
e0ec42
|
38 |
/// The userInfo key for the invalid argument value for errors with FBSDKErrorInvalidArgument. |
2e29a3
|
39 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorArgumentValueKey |
L |
40 |
NS_SWIFT_NAME(ErrorArgumentValueKey); |
|
41 |
|
|
42 |
/** |
|
43 |
The userInfo key for the message for developers in NSErrors that originate from the SDK. |
|
44 |
|
|
45 |
The developer message will not be localized and is not intended to be presented within the app. |
|
46 |
*/ |
|
47 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorDeveloperMessageKey |
|
48 |
NS_SWIFT_NAME(ErrorDeveloperMessageKey); |
|
49 |
|
e0ec42
|
50 |
/// The userInfo key describing a localized description that can be presented to the user. |
2e29a3
|
51 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedDescriptionKey |
L |
52 |
NS_SWIFT_NAME(ErrorLocalizedDescriptionKey); |
|
53 |
|
e0ec42
|
54 |
/// The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`. |
2e29a3
|
55 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKErrorLocalizedTitleKey |
L |
56 |
NS_SWIFT_NAME(ErrorLocalizedTitleKey); |
|
57 |
|
|
58 |
/* |
|
59 |
@methodgroup FBSDKGraphRequest error userInfo keys |
|
60 |
*/ |
|
61 |
|
|
62 |
/** |
|
63 |
The userInfo key describing the error category, for error recovery purposes. |
|
64 |
|
|
65 |
See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`. |
|
66 |
*/ |
|
67 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorKey |
|
68 |
NS_SWIFT_NAME(GraphRequestErrorKey); |
|
69 |
|
|
70 |
/* |
|
71 |
The userInfo key for the Graph API error code. |
|
72 |
*/ |
|
73 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorCodeKey |
|
74 |
NS_SWIFT_NAME(GraphRequestErrorGraphErrorCodeKey); |
|
75 |
|
|
76 |
/* |
|
77 |
The userInfo key for the Graph API error subcode. |
|
78 |
*/ |
|
79 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorGraphErrorSubcodeKey |
|
80 |
NS_SWIFT_NAME(GraphRequestErrorGraphErrorSubcodeKey); |
|
81 |
|
|
82 |
/* |
|
83 |
The userInfo key for the HTTP status code. |
|
84 |
*/ |
|
85 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorHTTPStatusCodeKey |
|
86 |
NS_SWIFT_NAME(GraphRequestErrorHTTPStatusCodeKey); |
|
87 |
|
|
88 |
/* |
|
89 |
The userInfo key for the raw JSON response. |
|
90 |
*/ |
|
91 |
FOUNDATION_EXPORT NSErrorUserInfoKey const FBSDKGraphRequestErrorParsedJSONResponseKey |
|
92 |
NS_SWIFT_NAME(GraphRequestErrorParsedJSONResponseKey); |
|
93 |
|
|
94 |
/* |
|
95 |
@methodgroup Common Code Block typedefs |
|
96 |
*/ |
|
97 |
|
e0ec42
|
98 |
/// Success Block |
2e29a3
|
99 |
typedef void (^ FBSDKCodeBlock)(void) |
L |
100 |
NS_SWIFT_NAME(CodeBlock); |
|
101 |
|
e0ec42
|
102 |
/// Error Block |
2e29a3
|
103 |
typedef void (^ FBSDKErrorBlock)(NSError *_Nullable error) |
L |
104 |
NS_SWIFT_NAME(ErrorBlock); |
|
105 |
|
e0ec42
|
106 |
/// Success Block |
2e29a3
|
107 |
typedef void (^ FBSDKSuccessBlock)(BOOL success, NSError *_Nullable error) |
L |
108 |
NS_SWIFT_NAME(SuccessBlock); |
|
109 |
|
|
110 |
/* |
|
111 |
@methodgroup Enums |
|
112 |
*/ |
|
113 |
|
|
114 |
#ifndef NS_ERROR_ENUM |
|
115 |
#define NS_ERROR_ENUM(_domain, _name) \ |
|
116 |
enum _name : NSInteger _name; \ |
|
117 |
enum __attribute__((ns_error_domain(_domain))) _name: NSInteger |
|
118 |
#endif |
|
119 |
|
|
120 |
/** |
|
121 |
FBSDKCoreError |
|
122 |
Error codes for FBSDKErrorDomain. |
|
123 |
*/ |
|
124 |
typedef NS_ERROR_ENUM (FBSDKErrorDomain, FBSDKCoreError) |
|
125 |
{ |
e0ec42
|
126 |
/// Reserved. |
2e29a3
|
127 |
FBSDKErrorReserved = 0, |
L |
128 |
|
e0ec42
|
129 |
/// The error code for errors from invalid encryption on incoming encryption URLs. |
2e29a3
|
130 |
FBSDKErrorEncryption, |
L |
131 |
|
e0ec42
|
132 |
/// The error code for errors from invalid arguments to SDK methods. |
2e29a3
|
133 |
FBSDKErrorInvalidArgument, |
L |
134 |
|
e0ec42
|
135 |
/// The error code for unknown errors. |
2e29a3
|
136 |
FBSDKErrorUnknown, |
L |
137 |
|
|
138 |
/** |
|
139 |
A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve |
|
140 |
the error object from the NSURLSession for more information. |
|
141 |
*/ |
|
142 |
FBSDKErrorNetwork, |
|
143 |
|
e0ec42
|
144 |
/// The error code for errors encountered during an App Events flush. |
2e29a3
|
145 |
FBSDKErrorAppEventsFlush, |
L |
146 |
|
|
147 |
/** |
|
148 |
An endpoint that returns a binary response was used with FBSDKGraphRequestConnection. |
|
149 |
|
|
150 |
Endpoints that return image/jpg, etc. should be accessed using NSURLRequest |
|
151 |
*/ |
|
152 |
FBSDKErrorGraphRequestNonTextMimeTypeReturned, |
|
153 |
|
|
154 |
/** |
|
155 |
The operation failed because the server returned an unexpected response. |
|
156 |
|
|
157 |
You can get this error if you are not using the most recent SDK, or you are accessing a version of the |
|
158 |
Graph API incompatible with the current SDK. |
|
159 |
*/ |
|
160 |
FBSDKErrorGraphRequestProtocolMismatch, |
|
161 |
|
|
162 |
/** |
|
163 |
The Graph API returned an error. |
|
164 |
|
|
165 |
See below for useful userInfo keys (beginning with FBSDKGraphRequestError*) |
|
166 |
*/ |
|
167 |
FBSDKErrorGraphRequestGraphAPI, |
|
168 |
|
|
169 |
/** |
|
170 |
The specified dialog configuration is not available. |
|
171 |
|
|
172 |
This error may signify that the configuration for the dialogs has not yet been downloaded from the server |
|
173 |
or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded. |
|
174 |
*/ |
|
175 |
FBSDKErrorDialogUnavailable, |
|
176 |
|
e0ec42
|
177 |
/// Indicates an operation failed because a required access token was not found. |
2e29a3
|
178 |
FBSDKErrorAccessTokenRequired, |
L |
179 |
|
e0ec42
|
180 |
/// Indicates an app switch (typically for a dialog) failed because the destination app is out of date. |
2e29a3
|
181 |
FBSDKErrorAppVersionUnsupported, |
L |
182 |
|
e0ec42
|
183 |
/// Indicates an app switch to the browser (typically for a dialog) failed. |
2e29a3
|
184 |
FBSDKErrorBrowserUnavailable, |
L |
185 |
|
e0ec42
|
186 |
/// Indicates that a bridge api interaction was interrupted. |
2e29a3
|
187 |
FBSDKErrorBridgeAPIInterruption, |
L |
188 |
|
e0ec42
|
189 |
/// Indicates that a bridge api response creation failed. |
2e29a3
|
190 |
FBSDKErrorBridgeAPIResponse, |
L |
191 |
} NS_SWIFT_NAME(CoreError); |
|
192 |
|
|
193 |
/** |
|
194 |
FBSDKGraphRequestError |
|
195 |
Describes the category of Facebook error. See `FBSDKGraphRequestErrorKey`. |
|
196 |
*/ |
|
197 |
typedef NS_ENUM(NSUInteger, FBSDKGraphRequestError) { |
e0ec42
|
198 |
/// The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. |
2e29a3
|
199 |
FBSDKGraphRequestErrorOther = 0, |
e0ec42
|
200 |
/// Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. |
2e29a3
|
201 |
FBSDKGraphRequestErrorTransient = 1, |
e0ec42
|
202 |
/// Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. |
2e29a3
|
203 |
FBSDKGraphRequestErrorRecoverable = 2, |
L |
204 |
} NS_SWIFT_NAME(GraphRequestError); |
|
205 |
|
e0ec42
|
206 |
/** |
L |
207 |
Internal value exposed to facilitate transition to Swift. |
|
208 |
API Subject to change or removal without warning. Do not use. |
|
209 |
|
|
210 |
@warning INTERNAL - DO NOT USE |
|
211 |
*/ |
|
212 |
FOUNDATION_EXPORT NSString *const DefaultKeychainServicePrefix; |
|
213 |
|
2e29a3
|
214 |
NS_ASSUME_NONNULL_END |