Skip to content

Commit 43356e1

Browse files
fix: resolve static linking issue for A0Auth0 Swift header import
1 parent d222af2 commit 43356e1

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

ios/A0Auth0.mm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22

33
#import <React/RCTUtils.h>
44

5-
#import "A0Auth0-Swift.h"
5+
/**
6+
* This preprocessor directive resolves the static linking issue by ensuring
7+
* the correct import of the Swift header file generated for the A0Auth0 module.
8+
* It checks for the presence of the header file in different locations:
9+
* 1. If the header is available in the framework's module path (<A0Auth0/A0Auth0-Swift.h>),
10+
* it imports it from there.
11+
* 2. As a fallback, it imports the header from the local path to ensure compatibility.
12+
*/
13+
#if __has_include(<A0Auth0/A0Auth0-Swift.h>)
14+
#import <A0Auth0/A0Auth0-Swift.h>
15+
#else
16+
#import "A0Auth0-Swift.h"
17+
#endif
18+
619
#define ERROR_CANCELLED @{@"error": @"a0.session.user_cancelled",@"error_description": @"User cancelled the Auth"}
720
#define ERROR_FAILED_TO_LOAD @{@"error": @"a0.session.failed_load",@"error_description": @"Failed to load url"}
821

0 commit comments

Comments
 (0)