Search Unity

iOS: Swift plugins in project on UCB

Discussion in 'Unity Cloud Build' started by Wanderer13, Dec 27, 2017.

  1. Wanderer13

    Wanderer13

    Joined:
    Feb 11, 2016
    Posts:
    14
    Hi there.
    I have recently added swift framework to my project. There is also Objective-C wrapper plugin for calling this framework's functionality. Seems that UCB doesn't support swift plugins, because once app built and runned on device, there is an error:

    dyld: Library not loaded: @rpath/libswiftCore.dylib
    Referenced from: /private/var/mobile/Containers/Bundle/Application/...<used swift framework>
    Reason: no suitable image found

    While, if I compile this project on Mac OS and run on device it's going well. If before compiling project in XCode set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to NO, same issue appears as in UCB build.

    Added iOS post processing settings:
    ENABLE_BITCODE = NO
    OTHER_LDFLAGS = -ObjC -v
    CLANG_ENABLE_MODULES = YES
    LD_RUNPATH_SEARCH_PATHS = $(inherited) $(SDKROOT) @loader_path/Frameworks @executable_path/Frameworks
    SWIFT_VERSION = 3.0
    ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
    EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
    Also, this swift framework added as additional copy files build phase to 'Frameworks' location.

    Apps/OS versions: MacOS Sierra 10.12.6, Unity 2017.1.1f1, XCode 8.3, swift 3
    Tested devices: iPhone 5 (iOS 10.2), iPhone 6+ (iOS 10.3)

    Does anyone successfully built app on UCB with swift plugins or encounter with such error?
     
  2. Wanderer13

    Wanderer13

    Joined:
    Feb 11, 2016
    Posts:
    14
    Btw found solution. Since UCB can't add standard swift libraries to build, it can be done in post processing script. Download libswiftCore.dylib, libswiftCoreGraphics.dylib, etc to unity project, and in post processing script add them to generated xcode project. Also need to add these libraries to copy files build phase, at 'Frameworks' location.
     
  3. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    411
    What is UCB ??
     
  4. Wanderer13

    Wanderer13

    Joined:
    Feb 11, 2016
    Posts:
    14
    Unity cloud build.