Xcode变量看不了

问题描述:
堆栈上一层都正常,这一层监视通通挂了,任何变量看不了

(lldb) po self
error: :1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {
^~~~~~~~~~~~~~~

error: :18:5: error: use of unresolved identifier '$__lldb_injected_self'
$__lldb_injected_self.$__lldb_wrapped_expr_32(
^~~~~~~~~~~~~~~~~~~~~

(lldb) po viewController
error: :3:1: error: use of unresolved identifier 'viewController'
viewController
^~~~~~~~~~~~~~

Xcode Version 8.2 (8C38)

Framework的@rpath问题

问题描述:最新的Xcode6开放了动态库支持,可以使Container和Extension共享一个Framework。最新开发通讯MC模块,也来试试看。单独运行Container,但是运行Extension时,报如下错误:

dyld: Library not loaded: @rpath/BIIPC.framework/BIIPC
Referenced from: /private/var/mobile/Containers/Bundle/Application/1548B083-7E48-4497-A8E3-0E65842F2EF4/BIIPCDemo.app/PlugIns/BIIPCKeyboard.appex/BIIPCKeyboard
Reason: image not found

问题分析:看报错信息,应该是没有找到Framework,要么是没有拷入BIIPCKeyboard目录,要么是运行目录环境参数没有设置到位。首先把Extension的Target中手动导入Framework,编译报错,提示有2个一样签名(动态库是需要签名)的资源。应该就是@rpath没有设置对。

问题解决:在Extension-Target-Building Settings中把Run path Search Paths增加一个路径:@executable_path/../../Frameworks

Swift下Array不能使用!可变标记

问题描述:Xcode beta4的Array从

  • var path:CGPath
  • []改成了

  • var path:[CGPath]
  • 这种用法。然后定义成

  • var path:[CGPath]!
  • ,报错如下:
    Immutable value of type only has mutating members named 'append'

    问题分析:可空符号其实是一层封装,使用时实际上需要压包和解包。使Array变成了let。可能是Xcode的一个bug。
    暂时先去除!,这样用:

  • var path:[CGPath]
  • Xcode6 beta2 不能调试extension问题

    问题描述:在用Xcode6 beta2联机调试输入法时出现如下问题
    Message from debugger: Terminated due to signal 9

    问题分析:查看xcode6 beta2 realse note,发现xcode这版不支持extension的调试
    • Debugging Share or Action app extensions does not work in this release. You will see an error
    message similar to: "The app on quit unexpectedly. Message
    from debugger: Terminated due to signal 9" (17303593)!

    PS:重启电脑和真机都无法解决此问题,上午坏了,下午莫名好了,用了一会又坏了

    Xcode5下iOS6.1的Tests运行不了

    问题描述:在Xcode 5.1.1中用模拟器iOS 6.1跑Tests提示如下错误:

    2014-06-18 14:40:49.581 sim[15948:303] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin/sim: Dead bootstrap subset.
    2014-06-18 14:40:50.817 sim[15948:303] Error spawning child process: No such file or directory

    未找到方法,好歹只有测试跑在iOS6.1跑不了

    Xcode升级导致插件失效

    问题描述:Xcode升级后有些插件失效

    问题分析:在控制台中查看log,显示是白名单问题

    问题解决:把Xcode的UUID加入插件plist中:
    XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
    defaults write ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/HOStringSense.xcplugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID

    Xcode创建动态库

    1.用Xcode打开如下2个xcspec文件:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/iPhoneOSPackageTypes.xcspec
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX Package Types.xcspec

    2.把MacOSX Package Types.xcspec中Identifier为com.apple.package-type.mach-o-dylib的item复制到iPhoneOSPackageTypes.xcspec

    3.把MacOSX Product Types.xcspec中Identifier为com.apple.product-type.library.dynamic的item复制到iPhoneOSProductTypes.xcspec

    以上为真机,模拟器类似,路径在:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/

     

    1.把/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/Framework & Library/Cocoa Touch Static Library.xctemplate整个文件夹复制并改名为Cocoa Touch Dynamic Library.xctemplate

    2.修改Description中的"a static library"为"a dynamic library"
    修改Identifier中的"cocoaTouchStaticLibrary"为"cocoaTouchDynamicLibrary"
    修改Description中的".static"为".dynamic"

     

    1.Installation Directory设置为@executable_path/