Closed j6alvarez closed 2 months ago
I have been doing some work with this repo https://github.com/callstack/react-native-visionos
And wanted to contribute sharing what made it work for me following the instructions in this post
Here is the needed code for it to run appleAuth methods for react-native-visionos
Steps:
RNAppleAuthentication.podspec
s.platforms = { :ios => "9.0", :osx => "10.15", :visionos => "1.0" }
Run bundle install and then bundle exec pod install. Then run build on xcode you'll find some errors
To fix the errors, look for this file RNAppleAuthASAuthorizationDelegates.m Add these imports
RNAppleAuthASAuthorizationDelegates.m
#import <UIKit/UIKit.h> #import <AuthenticationServices/AuthenticationServices.h>
Find this if
#if TARGET_OS_OSX return [[NSApplication sharedApplication] keyWindow]; #else return [[UIApplication sharedApplication] keyWindow]; #endif
And change it for this
#if TARGET_OS_OSX return [[NSApplication sharedApplication] keyWindow]; #else #if TARGET_OS_VISION // visionOS UIWindow *window = nil; NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes; for (UIScene *scene in connectedScenes) { if (scene.activationState == UISceneActivationStateForegroundActive && [scene isKindOfClass:[UIWindowScene class]]) { UIWindowScene *windowScene = (UIWindowScene *)scene; window = windowScene.windows.firstObject; break; } } return window; #else return [[UIApplication sharedApplication] keyWindow]; #endif #endif
Happy to take a PR here if you want to make one? Seems very reasonable
Done in #352, thanks!
I have been doing some work with this repo https://github.com/callstack/react-native-visionos
And wanted to contribute sharing what made it work for me following the instructions in this post
Here is the needed code for it to run appleAuth methods for react-native-visionos
Steps:
RNAppleAuthentication.podspec
Add visionos supports.platforms = { :ios => "9.0", :osx => "10.15", :visionos => "1.0" }
Run bundle install and then bundle exec pod install. Then run build on xcode you'll find some errors
To fix the errors, look for this file
RNAppleAuthASAuthorizationDelegates.m
Add these importsFind this if
And change it for this