The Dart VM Service was not discovered after 60 seconds
Describe the bug When launching my app with flutter run I cannot access debug mode. I get a blank screen and no logs. After 60 secs I get "The Dart VM Service was not discovered after 60 seconds". I have to put --release to get it to work. I use my Iphone with wired connection.
To Reproduce Steps to reproduce the behavior:
- Connect iphone
- flutter run & select Iphone
- Open app & nothing happens
- See error in vscode terminal
Expected behavior My unity scene launches in debug mode
Screenshots If applicable, add screenshots to help explain your problem.
Unity (please complete the following information):
- OS: Macos sequoia 15.3.1
- Version 6
Smartphone (please complete the following information):
- Device: Iphone 13
- OS: Ios
- Version 18.3.1
Additional context No issues with flutter doctor -v. Trying to launch only with xcode does not work as well, i've tried doing flutter attach too. This is not an issue with my iphone since a blank flutter project works in debug mode
@timbotimbo any chance I could get some help ?
In the Unity-Iphone I have duplicate symbols issues due to there being 2 "NativeCallProxy.mm" files in the Build Phases -> Compile sources.
The first file is at project/ios/UnityLibrary/Libraries/FlutterUnityIntegration/Plugins/iOS/NativeCallProxy.mm and the second is at project/ios/UnityLibrary/Libraries/Plugins/iOS/NativeCallProxy.mm.
First file
/ .mm file
#import <Foundation/Foundation.h>
#import "NativeCallProxy.h"
@implementation FrameworkLibAPI
id<NativeCallsProtocol> api = NULL;
+(void) registerAPIforNativeCalls:(id<NativeCallsProtocol>) aApi
{
api = aApi;
}
@end
extern "C" {
void showHostMainWindow() { return [api showHostMainWindow]; }
void unloadPlayer() { return [api unloadPlayer]; }
void quitPlayer() { return [api quitPlayer]; }
}
// .h file
// [!] important set UnityFramework in Target Membership for this file
// [!] and set Public header visibility
#import <Foundation/Foundation.h>
// NativeCallsProtocol defines protocol with methods you want to be called from managed
@protocol NativeCallsProtocol
@required
- (void) showHostMainWindow;
- (void) unloadPlayer;
- (void) quitPlayer;
// other methods
@end
__attribute__ ((visibility("default")))
@interface FrameworkLibAPI : NSObject
// call it any time after UnityFrameworkLoad to set object implementing NativeCallsProtocol methods
+(void) registerAPIforNativeCalls:(id<NativeCallsProtocol>) aApi;
@end
Second file
mm file
#import <Foundation/Foundation.h>
#import "NativeCallProxy.h"
@implementation FrameworkLibAPI
id<NativeCallsProtocol> api = NULL;
+(void) registerAPIforNativeCalls:(id<NativeCallsProtocol>) aApi
{
api = aApi;
}
@end
extern "C"
{
void sendMessageToMobileApp(const char* message)
{
return [api sendMessageToMobileApp:[NSString stringWithUTF8String:message]];
}
}
.h file
#import <Foundation/Foundation.h>
@protocol NativeCallsProtocol
@required
- (void) sendMessageToMobileApp:(NSString*)message;
@end
__attribute__ ((visibility("default")))
@interface FrameworkLibAPI : NSObject
+(void) registerAPIforNativeCalls:(id<NativeCallsProtocol>) aApi;
@end
I've tried merging the 2 files and removing one from the compile sources, but I get the white screen with the same error about the dart vm service as the app launches on my phone