Cannot receive URL Scheme with App not running

Hi.I made a iOS app to receive URL Scheme from Browser and show URL.
But sometimes not works.(Launch App is always no problem, but cannot receive URL)
Can you help me?

Suspend or Background → fine

Not running → bad

UrlReceiver.cs (Attach with Empty Object)

public class UrlReceiver : MonoBehaviour {
public Text text;

	void OnOpenUrl(string url){
		text.text = url;

#import "UnityAppController.h"

void UnitySendMessage(const char* objName, const char* methodName, const char* param);

char* MakeStringUrl(const char* string) {
    if (string == NULL) return NULL;
    char* res = (char*)malloc(strlen(string) + 1);
    strcpy(res, string);
    return res;

@interface UnitySchemeController : UnityAppController{  

@implementation UnitySchemeController

-(BOOL) application:(nonnull UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
    NSString* message = [url absoluteString];
    UnitySendMessage("UrlReceiver", "OnOpenUrl", MakeStringUrl([message UTF8String]));
    return YES;



The best way to do it is to save the urlscheme data in playerprefs and access that in unity.

For example do something like this-

-(BOOL) application:(nonnull UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
if([url.absoluteString rangeOfString:@"mygame://text="].location != NSNotFound){
  [[NSUserDefaults standardUserDefaults] setObject:url.absoluteString forKey:@"myurl"];
  [[NSUserDefaults standardUserDefaults] synchronize];

This will store your urlscheme data to myurl key in playerprefs. Also you need to check some predefined text in urlscheme before saving so that every url scheme will not get saved in myurl key.