美文网首页
InjectionIII知识点汇集

InjectionIII知识点汇集

作者: JoeSense | 来源:发表于2018-06-21 13:45 被阅读0次

    rsync 工具,在build之后的脚本中用于copy bundle文件进framework。
    貌似是个功能强大的工具,杀鸡用牛刀?
    http://man.linuxde.net/rsync

    app sandbox switched
    Mac app有一个沙盒设置: <key>com.apple.security.app-sandbox</key>
    上线时需要打开,打开之后就无法访问到应用之外的数据(有一个特例是用户制定某个外部路径,指定之后就可以根据路径访问到对应的外部数据了)

    image.png
      //沙盒开关打开后,像 xcode.activeWorkspaceDocument这样的数据就取不到了
        XcodeApplication *xcode = (XcodeApplication *)[SBApplication
                                                       applicationWithBundleIdentifier:XcodeBundleID];
        XcodeWorkspaceDocument *workspace = [xcode activeWorkspaceDocument];
    

    具体可以参考这个文章,图文说明比较清晰: http://www.skyfox.org/cocoa-macos-sandbox.html

    因为是swifte混编,使用其他方式(比如改成framework),总有些编译或者无法加载的问题。还是改成oc的库方便点。

    折腾了半天,moduleName-Swift.h not found错误很容易出现,太坑了。
    其次是想换成framework,但是因为混编问题,导致编译不过。
    InjectionBundle编译是用macos的SDK,所以生成的是Mac的bundle。iOS的bundle是在脚本里附带生成的(同时生成的还有tvOS的bundle)
    想把InjectionBundle改成iOS的SDK,结果swift类not found。
    坑坑坑 还是努力改成OC。
    对了 还有swift语法,真是要去熟悉一下了。不然好的库都看不懂啊。

    在iOS环境执行shell command?学到了,有空试试

    let pid = fork()
    if pid == 0 {
        var args = [UnsafeMutablePointer<Int8>?](repeating: nil, count: 4)
        args[0] = strdup("/bin/bash")!
        args[1] = strdup("-c")!
        args[2] = strdup(command)!
        args.withUnsafeMutableBufferPointer {
            _ = execve("/bin/bash", $0.baseAddress!, nil) // _NSGetEnviron().pointee)
            fatalError("execve() fails \(String(cString: strerror(errno)))")
        }
    }
    
    var status: Int32 = 0
    while waitpid(pid, &status, 0) == -1 {}
    return status >> 8 == EXIT_SUCCESS

    相关文章

      网友评论

          本文标题:InjectionIII知识点汇集

          本文链接:https://www.haomeiwen.com/subject/ibvqyftx.html