TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2017 |
Maintained by mkoosun.
SafariCookieBridge can get data from Safari's Cookie, and also set data to Cookie. Very convenient to transfer data between App and Web, even if App is not installed. You can fetch cookie data after user install your App, and let user continue to do something that he want do in Web Page
SafariCookieBridge is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SafariCookieBridge"
Put cookie.html
on your server, for example:
Add a scheme to the project, for example:
myScheme
Call SafariCookieBridge.openURL
in AppDelegate.m
-(BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
return [SafariCookieBridge openURL:url];
}
[SafariCookieBridge setCookieWithName:@"userid" value:@"testValue" scheme:@"myScheme" url:@"http://yourserver.com/cookie.html" timeout:30 block:^(BOOL success, NSString *value) {
if(success)
NSLog(@"Set cookie success");
else
NSLog(@"Set cookie fail");
}];
[SafariCookieBridge getCookieWithName:@"userid" scheme:@"myScheme" url:@"http://yourserver.com/cookie.html" timeout:10 block:^(BOOL success, NSString *value) {
if(success && value) {
NSLog(@"Get cookie userid = %@", value);
} else {
NSLog(@"Get cookie fail");
}
}];
wanglin.sun, [email protected]
SafariCookieBridge is available under the MIT license. See the LICENSE file for more info.