software-mansion / radon-ide

VSCode extension that turns your editor into a fully fledged IDE for React Native and Expo.
https://ide.swmansion.com
Other
998 stars 35 forks source link

[iOS] Add native logs #742

Closed maciekstosio closed 4 days ago

maciekstosio commented 1 week ago

The motivation of this PR is to pass native logs to Radon IDE. Currently, if the app crashes on the native side developer needs to open Xcode anyway.

⚠️ DISCLAIMER: The current approach won't work with Expo Go and Expo Dev Client, as those are run through deep link not xcrun simctl launch.

I tried: xcrun simctl --set {deviceLocation} spawn booted log stream, react-native log-ios, looking through files in the container if there is something that looks like logs - none of those work.

What I did:

Changed during review:

What I did:

How Has This Been Tested:

Normal:

  1. Start by adding to AppDelegate.mm, didFinishLaunchingWithOptions:
    NSLog(@"AppDelegate didFinishLaunchingWithOptions");
  2. Start the app
  3. Go to Radon IDE (iOS Simulator Logs) output
  4. Verify the logs are ther
  5. Restart app process, verify that new logs are comming

Crash:

  1. Start by adding to AppDelegate.mm, didFinishLaunchingWithOptions:

    
    
    NSLog(@"AppDelegate didFinishLaunchingWithOptions");
    
    double delayInSeconds = 5.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); // 1 
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ // 2 
    @throw [NSException exceptionWithName:@"Something is not right exception"
                                reason:@"Can't perform this operation because of this or that"
                              userInfo:nil];
    });

1. Start the app, it should crash after 5s
2. Go to `Radon IDE (iOS Simulator Logs)` output
3. Look for the error in the output 

### Demo

<video src="https://github.com/user-attachments/assets/ed065f66-b710-4227-8ec6-7ebb72b3964f" />
vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radon-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 10:12am