zoukankan      html  css  js  c++  java
  • Swift 遇到的报错信息

    1. 第一个,没看懂。一开始还以为是不支持iOS7的缘故。
    dyld: Library not loaded: @rpath/libswiftCore.dylib
      Referenced from: /var/mobile/Applications/9D80DFDC-2568-4328-B0BF-6418C3702DE4/swift02_project.app/swift02_project
      Reason: no suitable image found.  Did find:
    /private/var/mobile/Applications/9D80DFDC-2568-4328-B0BF-6418C3702DE4/swift02_project.app/Frameworks/libswiftCore.dylib: code signature invalid for '/private/var/mobile/Applications/9D80DFDC-2568-4328-B0BF-6418C3702DE4/swift02_project.app/Frameworks/libswiftCore.dylib'
    

      未解决。第二次运行,就没有这个报错了。

    • 在安装CocoaPods的时候提示的。
    [!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: SwiftyModel
    

      意思是说:CocoaPods在Swift里面,只能以framework的形式使用,所以要加这句话。那么这句话在哪里加呢?在Podfile里面,在写完所有的语句之后,加上这句,示例如下:

    platform :ios ,'8.0'
    pod 'SwiftyModel', '~> 0.1.0'
    use_frameworks!         
    

      再重新install就可以了。  

    • can't convert value of type 'AnyObject' to specified type 'NSMutableArray'

      

      报这个错的原因,我认为是因为,这个字典不想让乱七八糟的东西,成为自己的关键字。所以在后面,要加个类型说明。

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
            let cell = self.tableView!.dequeueReusableCellWithIdentifier("cell")
            let sectionArr:NSArray = self.dataDic.allKeys
            let sectionText:String = sectionArr.objectAtIndex(indexPath.section) as! String
            let rowArr:NSMutableArray = self.dataDic.objectForKey(sectionText) as! NSMutableArray
            let rowDic:NSDictionary = rowArr.objectAtIndex(indexPath.row) as! NSDictionary
            let cityName:String  = rowDic.objectForKey("city") as! String
            cell?.textLabel?.text = cityName
            return cell!
        }
    

      这样就可以了。在后面标明被取出来的数值,将会以什么样的形式显示,就可以了。

  • 相关阅读:
    Balanced Substring
    解决vscode可以编译通过c++项目,但头文件有红色波浪线的问题
    Poj2299---Ultra-QuickSort
    树状数组
    内置函数
    函数式编程,尾调用,map函数,filter函数,reduce函数
    函数作用域和匿名函数
    函数参数/局部变量与全局变量/前向引用(函数即变量)
    函数的定义
    字符串格式化
  • 原文地址:https://www.cnblogs.com/tanglimei/p/5129556.html
Copyright © 2011-2022 走看看