question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: App breaks on native iOS device using custom framework

See original GitHub issue

Bug Report

Capacitor Version

npx cap doctor output:

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 1.4.0

  @capacitor/core: 1.4.0

  @capacitor/android: 1.4.0

  @capacitor/ios: 1.4.0

Installed Dependencies:

  @capacitor/android not installed

  @capacitor/cli 1.3.0

  @capacitor/core 1.3.0

  @capacitor/ios 1.3.0


  Found 0 Capacitor plugins for ios:
[success] iOS looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

  • I created a simple capacitor application using Ionic CLI (5.4.12) with the following steps:
    ionic start ionic-gomobile-example tabs --capacitor
    ionic build
    npx cap add ios
    npx cap copy
    
  • Then I added a custom framework to the iOS application.
  • After that I added a native function which calls a function from the framework. The native function is called from the ionic project.
  • If I run the iOS application in the Xcode simulator everything works as expected, but when I run the application on a native device I get the following error:
    ⚡️  ERROR: Unable to load public//index.html
    ⚡️  This file is the root of your web app and must exist before
    ⚡️  Capacitor can run. Ensure you've run capacitor copy at least
    ⚡️  or, if embedding, that this directory exists as a resource directory.
    Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/ricoberger/Documents/GitHub/ionic-gomobile-example/node_modules/@capacitor/ios/ios/Capacitor/Capacitor/CAPBridgeViewController.swift, line 160
    2019-11-24 17:29:37.060529+0100 App[23071:10467244] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/ricoberger/Documents/GitHub/ionic-gomobile-example/node_modules/@capacitor/ios/ios/Capacitor/Capacitor/CAPBridgeViewController.swift, line 160
    (lldb) 
    

Expected Behavior

The application should also start on the native device, without an error.

On Android the application works on the simulator and on a native device. The iOS framework is also working within a native app, so I think the bug is within Capacitor.

Sample Code or Sample Application Repo

The issue is reproducible with the following code: https://github.com/ricoberger/ionic-gomobile-example

Other Technical Details

npm --version output: 6.13.2

node --version output: v13.3.0

pod --version output (iOS issues only): 1.8.4

Other Information

Maybe related to #2184

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
codeRenegadecommented, Oct 28, 2020

Still getting this issue with

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 2.4.2
  @capacitor/core: 2.4.2
  @capacitor/android: 2.4.2
  @capacitor/electron: 2.4.2
  @capacitor/ios: 2.4.2

Installed Dependencies:

  @capacitor/cli 2.4.2
  @capacitor/ios 2.4.2
  @capacitor/core 2.4.2
  @capacitor/android 2.4.2
  @capacitor/electron not installed

  Found 0 Capacitor plugins for ios:
[success] iOS looking great! 👌

I am learning and playing without ionic but as a standalone.

0reactions
ionitron-bot[bot]commented, Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Framework does not load on simulator - Apple Developer
When trying to launch the app in the simulator without debug session (by double clicking on the icon), it crashes with the log...
Read more >
iOS app with framework crashed on device, dyld: Library not ...
In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved. Reference is...
Read more >
Xamarin.iOS errors - Microsoft Learn
This document describes various errors generated by mtouch, the tool used to bundle Xamarin.iOS applications. Errors are listed by code and ...
Read more >
New features in Android Studio Preview - Android Developers
Live Edit; SDK insights; App Quality Insights from Firebase Crashlytics ... The Details panel breaks down the crash counts by device type and...
Read more >
Flutter vs React Native: Everything You Need To Know in 2022
Read on as we break down the pros and cons in the Flutter vs React Native debate. ... language to build your app's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found