Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS crash when accessing any Unity screen #592

Closed
fedper95 opened this issue May 23, 2022 · 11 comments
Closed

iOS crash when accessing any Unity screen #592

fedper95 opened this issue May 23, 2022 · 11 comments

Comments

@fedper95
Copy link

Hello!

Describe the bug

When I enter any unity screen, the app crashes with the following message:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010f07ad68 UnityFramework`::SetFromParameters() at BootConfigData.cpp:273:64 [opt]

To Reproduce
Steps to reproduce the behavior:

  1. Try to access any Unity screen
  2. The app crashes

Expected behavior
The app does not crash and the screen is loaded correctly.

Unity (please complete the following information):

  • OS: iOS / macOS / Unity / Flutter
  • Unity Version 2019.4.1f1

Smartphone (please complete the following information):

  • Device: iphone 7
  • OS: iOS 15.3.1
  • Version: 19D52

Additional context

@jamesncl
Copy link

It may be because you're not using the Unity version which the plugin author has targeted, which is 2022.1.0? You could try upgrading your unity to 2022.1.0 (make sure you backup first or use version control), rebuild and see if that resolves the error

@fedper95
Copy link
Author

Hi @jamesncl !
I tried that, I upgraded the project to 2022.1.0 but after the upgrade whenever I try to build iOS the build finishes without any notification message (success or failure) and I can't find any Builds/ios folder so I think it's not exporting.

@fedper95
Copy link
Author

I'm only getting these kind of warnings
image

In my case when importing the FlutterUnityPackage.unitypackage file I got errors indicating I had multiple precompiled assemblies with the same name (Newtonsoft.Json.dll) So I had to exclude that one from being imported.

Could that be the cause?

@fedper95
Copy link
Author

fedper95 commented May 27, 2022

Update, did some workaround to be able to import Newtonsoft.json and I'm still getting the same result.

The workaround was removing Unity's version control package.

@fedper95
Copy link
Author

fedper95 commented May 27, 2022

Update: The exports were already working, but they were being created outside the unity folder and directly under the ios folder. I expected them to appear inside the projects folder and had placed the unity folder in my workspace, so I never found them between the other folders I have.

I followed the rest of the steps in the new docs and am getting this error when building iOS:

image

Edit:

It was actually an issue with my xcode configuration. Solved it by deleting Unity-iPhone project and selecting deleting all references in the prompt. Also manually deleted UnityFramework.framework from Pods project > General > Frameworks and Libraries.

Then reinstalling everything back again as suggested in the docs.

@fedper95
Copy link
Author

Tried this, no luck: #574

@juicycleff
Copy link
Owner

@fedper95 This has been fixed in the latest releases

@croe
Copy link

croe commented Jul 11, 2022

@juicycleff
I have the same problem... Which is the fixed version?

Environment is as follows

Unity (please complete the following information):

  • OS: iOS
  • Unity Version 2021.3.5f1, 2022.1.7f1 (same error)

Smartphone (please complete the following information):

  • Device: iPad Pro (11-inch) (3rd generation)
  • OS: iOS 15.5

Additional context

  • Flutter version: 3.0.1
  • flutter_unity_widget v2022.1.1+4
  • fuw-2022.1.1-v2.unitypackage

@juicycleff
Copy link
Owner

Update: The exports were already working, but they were being created outside the unity folder and directly under the ios folder. I expected them to appear inside the projects folder and had placed the unity folder in my workspace, so I never found them between the other folders I have.

I followed the rest of the steps in the new docs and am getting this error when building iOS:

image

Edit:

It was actually an issue with my xcode configuration. Solved it by deleting Unity-iPhone project and selecting deleting all references in the prompt. Also manually deleted UnityFramework.framework from Pods project > General > Frameworks and Libraries.

Then reinstalling everything back again as suggested in the docs.

Sometimes this error is throw because unity soemthings ignores the post build process script, however running it multiple times or deleting the old folder and exporting again solved this issue

@yvz-dmr
Copy link

yvz-dmr commented Aug 14, 2022

I am having the same problem, is there any fix for it?

Unity version: 2021.3.3f1
Flutter unity widget version: 2022.1.7+1
Crash Logs:
Incident Identifier: 6256C393-2563-45E3-9F82-669A3E186726
Hardware Model: iPhone13,3
Process: Runner [26805]
Path: /private/var/containers/Bundle/Application/E1ED6FAA-7155-4FAB-9A11-A2267700BF2B/Runner.app/Runner

AppStoreTools: 13F100
AppVariant: 1:iPhone13,3:15
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]

Date/Time: 2022-08-13 19:23:32.9615 -0500
Launch Time: 2022-08-13 19:23:32.5028 -0500
OS Version: iPhone OS 15.5 (19F77)
Release Type: User
Baseband Version: 2.54.02
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4375707648
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 104d00000-104d04000 [ 16K] r-x/r-x SM=COW ...er.app/Runner
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [26805]

Triggered by Thread: 0

Thread 0 name:
Thread 0 Crashed:
0 UnityFramework 0x00000001092067c8 BootConfig::SetFromParameters(BootConfig::Data&, char const**, unsigned long) + 72 (BootConfigData.cpp:273)
1 UnityFramework 0x00000001092061ac BootConfig::Data::InitFromFile(char const**, unsigned long, char const*) + 272 (BootConfigData.cpp:362)
2 UnityFramework 0x00000001092062a0 InitFromFile + 24 (BootConfig.cpp:40)
3 UnityFramework 0x00000001092062a0 BootConfig::InitFromFileFormatted(char const**, unsigned long, char const*, ...) + 148 (BootConfig.cpp:61)
4 UnityFramework 0x00000001098f11d8 UnityInitRuntime + 156 (LibEntryPoint.mm:140)
5 UnityFramework 0x0000000108d36e30 -[UnityFramework frameworkWarmup:argv:] + 36 (main.mm:76)
6 UnityFramework 0x0000000108d36f68 -[UnityFramework runEmbeddedWithArgc:argv:appLaunchOpts:] + 132 (main.mm:115)
7 flutter_unity_widget 0x000000010589be2c UnityPlayerUtils.initUnity() + 348 (UnityPlayerUtils.swift:93)
8 flutter_unity_widget 0x000000010589cf08 closure #2 in UnityPlayerUtils.createPlayer(completed:) + 32 (UnityPlayerUtils.swift:135)
9 flutter_unity_widget 0x000000010589cfb4 thunk for @escaping @callee_guaranteed () -> () + 20 (:0)
10 libdispatch.dylib 0x00000001b7cb6e6c _dispatch_call_block_and_release + 32 (init.c:1517)
11 libdispatch.dylib 0x00000001b7cb8a30 _dispatch_client_callout + 20 (object.m:560)
12 libdispatch.dylib 0x00000001b7cc6f48 _dispatch_main_queue_drain + 928 (inline_internal.h:2622)
13 libdispatch.dylib 0x00000001b7cc6b98 _dispatch_main_queue_callback_4CF + 44 (queue.c:7770)
14 CoreFoundation 0x00000001b8009800 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 (CFRunLoop.c:1795)
15 CoreFoundation 0x00000001b7fc3704 __CFRunLoopRun + 2532 (CFRunLoop.c:3144)
16 CoreFoundation 0x00000001b7fd6bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
17 GraphicsServices 0x00000001d410a374 GSEventRunModal + 164 (GSEvent.c:2200)
18 UIKitCore 0x00000001ba946648 -[UIApplication _run] + 1100 (UIApplication.m:3511)
19 UIKitCore 0x00000001ba6c7d90 UIApplicationMain + 364 (UIApplication.m:5064)
20 Runner 0x0000000104d05fa4 main + 64 (AppDelegate.swift:5)
21 dyld 0x00000001051b1ce4 start + 520 (dyldMain.cpp:879)

@dinonovak
Copy link

dinonovak commented Dec 17, 2022

make sure that iOS/Runner/AppDelegate.swift includes units widget reference

import UIKit
import Flutter
import flutter_unity_widget /* Add this */

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    InitUnityIntegrationWithOptions(argc: CommandLine.argc, argv: CommandLine.unsafeArgv, launchOptions) /* Add this */

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants