代码之家  ›  专栏  ›  技术社区  ›  rustyMagnet

lldb错误:无法查找符号。斯威夫特iOS

  •  0
  • rustyMagnet  · 技术社区  · 6 年前

    我将lldb附加到我的发布版本中,在模拟器上。

    主要应用程序-工程

    (lldb) exp let $c = hello_class()
    error: <EXPR>:3:10: error: use of unresolved identifier 'hello_class'
    let $c = hello_class()
             ^~~~~~~~~~~
    (lldb) expr import My_App
    (lldb) exp let $c = hello_class()
    (lldb) po $c.hello()
    🔸 hello 🔸
    

    框架失败-动态

    (lldb) dclass -m myframework
    Dumping classes
    ************************************************************
    myframework.RustyAppInfo
    
    (lldb) expr import myframework
    (lldb) expr let $d = RustyAppInfo()
    error: Couldn't lookup symbols:
      __T011myframework12RustyAppInfoCACycfC
    

    应用程序和动态框架都是在没有优化的情况下构建的。

    更新

    静态框架-失败

    换成Xcode9引入了特性静态Swift框架时,结果也一样。

    Xcode-死代码剥离

    Dead Code Stripping

    1 回复  |  直到 5 年前
        1
  •  1
  •   rustyMagnet    6 年前

    断然的

    http://iosbrain.com/blog/2018/01/13/building-swift-4-frameworks-and-including-them-in-your-apps-xcode-9/

    我没能定下来 public init()

    // set the Framework class to Public
    public class rnHello{  
    
       // set the initializer to public, otherwise you cannot invoke class
        public init() {  
    
        }
    
        // set the function to public, as it defaults to internal
        public static func world() {  
            print("hello from a static method")
        }
    }
    

    现在您可以通过Swift代码或lldb访问:

    (lldb) po rnHello.world()
    hello from a static method