iOS SDK Version

FBSDKUtility

@interfaceFBSDKUtility:NSObject
Class to contain common utility methods.
  • Unavailable
    Undocumented

    Declaration

    Objective-C
    -(instancetype)initNS_UNAVAILABLE;
  • Unavailable
    Undocumented

    Declaration

    Objective-C
    +(instancetype)newNS_UNAVAILABLE;
  • Parses a query string into a dictionary.

    Declaration

    Objective-C
    +(nonnullNSDictionary<NSString*,NSString*>*)dictionaryWithQueryString:(nonnullNSString*)queryString;
    Swift
    classfuncdictionary(withQueryqueryString:String)->[String:String]

    Parameters

    queryString
    The query string value.

    Return Value

    A dictionary with the key/value pairs.
  • Constructs a query string from a dictionary.

    Declaration

    Objective-C
    +(nonnullNSString*)queryStringWithDictionary:(nonnullNSDictionary<NSString*,id>*)dictionaryerror:(NSError*_Nullable*_Nullable)errorRef;
    Swift
    classfuncquery(fromdictionary:[String:Any])throws->String

    Parameters

    dictionary
    The dictionary with key/value pairs for the query string.
    errorRef
    If an error occurs, upon return contains an NSError object that describes the problem.

    Return Value

    Query string representation of the parameters.
  • Decodes a value from an URL.

    Declaration

    Objective-C
    +(nonnullNSString*)URLDecode:(nonnullNSString*)value;
    Swift
    classfuncdecode(urlStringvalue:String)->String

    Parameters

    value
    The value to decode.

    Return Value

    The decoded value.
  • Encodes a value for an URL.

    Declaration

    Objective-C
    +(nonnullNSString*)URLEncode:(nonnullNSString*)value;
    Swift
    classfuncencode(urlStringvalue:String)->String

    Parameters

    value
    The value to encode.

    Return Value

    The encoded value.
  • Creates a timer using Grand Central Dispatch.

    Declaration

    Objective-C
    +(nonnulldispatch_source_t)startGCDTimerWithInterval:(double)intervalblock:(nonnulldispatch_block_t)block;
    Swift
    classfuncstartGCDTimer(withIntervalinterval:Double,block:@escaping()->Void)->DispatchSource

    Parameters

    interval
    The interval to fire the timer, in seconds.
    block
    The code block to execute when timer is fired.

    Return Value

    The dispatch handle.
  • Stop a timer that was started by startGCDTimerWithInterval.

    Declaration

    Objective-C
    +(void)stopGCDTimer:(nonnulldispatch_source_t)timer;
    Swift
    classfuncstopGCDTimer(_timer:DispatchSource)

    Parameters

    timer
    The dispatch handle received from startGCDTimerWithInterval.
  • Get SHA256 hased string of NSString/NSData

    Declaration

    Objective-C
    +(nullableNSString*)SHA256Hash:(nullableNSObject*)input;
    Swift
    classfuncsha256Hash(_input:NSObject?)->String?

    Parameters

    input
    The data that needs to be hashed, it could be NSString or NSData.