Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18844] iOS: Swift is not supported for Extensions

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-04-22T16:56:19.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsiOS
LabelsExtension, WatchKit, ios
ReporterJamie Druce
AssigneePedro Enrique
Created2015-04-20T17:19:53.000+0000
Updated2017-03-23T18:08:51.000+0000

Description

I have built a WatchKit extension in Swift. All works beautifully in the simulator when running directly from xcode. I have linked to the extension from my Titanium project, and everything builds without error, yet when running the "xcrun simctl launch booted" command to launch the watch, I get an infinite loading animation. Upon digging through the logs I got many errors such as “Unable to start plugin” and "activePlugInForIdentifier: returned nil for application". I also stumbled upon a crash log which seems to point the finger more accurately: Process: JAS Watch WatchKit Extension [27101] Dyld Error Message: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/4CEFE848-E6EB-41D2-8968-754C449E19A8/data/Containers/Bundle/Application/5B42A276-DD25-4288-82A4-C1C2CFBE527E/Just a Score.app/PlugIns/JAS Watch WatchKit Extension.appex/JAS Watch WatchKit Extension Reason: image not found It seems that “libswiftCore.dylib” is not getting included, a quick Google search will lead you to discover that there is a flag in a projects build settings called “Embedded Content Contains Swift Code”. This flag needs to be checked in order to run an objective-c project with embedded Swift content. I’m sure this would be the case with any Swift extension and Titanium for reproduction. Hopefully this flag solves the issue. Urgency in finding a solution to this would be greatly appreciated.

Comments

  1. Pedro Enrique 2015-04-21

    Jamie, have you tried switching that flag in the Titanium Xcode project? Give this a try and let us know. 1. Open the Xcode project of the titanium sdks dir, for example: /Users/penrique/Library/Application Support/Titanium/mobilesdk/osx/4.0.0.Beta/iphone/iphone/Titanium.xcodeproj 2. Go to the project Build Settings settings and look for "Embedded Content Contains Swift Code" and change it from "No" to "Yes" 3. Close that 4. Go to Appcelerator Studio (or the command line) and clean your project. 5. Built it again and see if that worked.
  2. Jamie Druce 2015-04-21

    Pedro you are my hero! Thats done it! that was the difference between nothing working and having my watch app running perfectly in the simulator. I'm happy, i guess this just needs to be an option in Titanium somewhere in a future update. Thanks greatly!
  3. Pedro Enrique 2015-04-21

    Great news Jamie! I have field a PR and will soon be merged https://github.com/appcelerator/titanium_mobile/pull/6792
  4. Rick Blalock 2015-04-22

    sweet
  5. Fokke Zandbergen 2015-12-02

    I did not run into this error while resolving TIMOB-20070 so I assume this ticket actually is already resolved by something between april and now.
  6. Lee Morris 2017-03-23

    Closing ticket as fixed with reference to above comments.

JSON Source