Skip to content
This repository was archived by the owner on Jan 24, 2020. It is now read-only.

Commit beacdff

Browse files
committed
Merge pull request #1 from kivikakk/ios-first-launch-bug
Fix exception on first run when there is no Cookie header.
2 parents db9c913 + 3592d59 commit beacdff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

RNCookieManagerIOS/RNCookieManagerIOS.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ @implementation RNCookieManagerIOS
4242
RCT_EXPORT_METHOD(get:(NSURL *)url callback:(RCTResponseSenderBlock)callback) {
4343
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
4444
NSDictionary *headers = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
45-
callback(@[headers[@"Cookie"], @"success"]);
45+
if ([headers objectForKey:@"Cookie"] == nil) {
46+
callback(@[[NSNull null], @"success"]);
47+
} else {
48+
callback(@[headers[@"Cookie"], @"success"]);
49+
}
4650
}
4751

4852
RCT_EXPORT_METHOD(clearAll:(RCTResponseSenderBlock)callback) {

0 commit comments

Comments
 (0)