2015-09-21 110 views
0

我在運行時出現「命令因信號失敗:分段錯誤:11」錯誤。我相信這是一個編譯錯誤,因爲當我清理我的代碼時,它沒有任何錯誤,只有當我運行&構建。我正在使用新的Xcode beta 7.1。我也通過我的Xcode 7.0構建它,但收到相同的錯誤。Xcode錯誤:命令因信號失敗:分段錯誤:11

Swift代碼以前沒有錯誤構建。此代碼正在處理一個Parse後端並查詢一些信息以顯示給用戶;這裏是下面的日誌:我搜索爲什麼錯誤

1. While type-checking 'viewDidLoad' at /Users/User/Documents/Documents/ProjectName/UserProfile.swift:27:14 
2. While type-checking expression at [/Users/User/Documents/Documents/ProjectName/UserProfile.swift:34:9 - line:55:9] RangeText="query.findObjectsInBackgroundWithBlock { 
     (objects: [AnyObject]?, error: NSError?) -> Void in 

     if error == nil { 
      if let objects = objects as? [PFObject] { 
       for object in objects { 
        let userImageFile: PFFile = object.objectForKey("ProfPhoto") as! PFFile 
        userImageFile.getDataInBackgroundWithBlock { 
         (imageData: NSData?, error: NSError?) -> Void in 
         if error == nil { 
          if let imageData = imageData { 
           self.ProfileImage.image = UIImage(data:imageData) 
          } 
         } 
        } 
       } 
      } 
     } else { 
      // Log details of the failure 
      print("Error: \(error!) \(error!.userInfo)") 
     } 
    }" 
3. While type-checking expression at [/Users/User/Documents/Documents/ProjectName/UserProfile.swift:34:9 - line:55:9] RangeText="query.findObjectsInBackgroundWithBlock { 
     (objects: [AnyObject]?, error: NSError?) -> Void in 

     if error == nil { 
      if let objects = objects as? [PFObject] { 
       for object in objects { 
        let userImageFile: PFFile = object.objectForKey("ProfPhoto") as! PFFile 
        userImageFile.getDataInBackgroundWithBlock { 
         (imageData: NSData?, error: NSError?) -> Void in 
         if error == nil { 
          if let imageData = imageData { 
           self.ProfileImage.image = UIImage(data:imageData) 
          } 
         } 
        } 
       } 
      } 
     } else { 
      // Log details of the failure 
      print("Error: \(error!) \(error!.userInfo)") 
     } 
    }" 
    4. While type-checking expression at [/Users/User/Documents/Documents/ProjectName/UserProfile.swift:34:48 - line:55:9] RangeText="{ 
     (objects: [AnyObject]?, error: NSError?) -> Void in 

     if error == nil { 
      if let objects = objects as? [PFObject] { 
       for object in objects { 
        let userImageFile: PFFile = object.objectForKey("ProfPhoto") as! PFFile 
        userImageFile.getDataInBackgroundWithBlock { 
         (imageData: NSData?, error: NSError?) -> Void in 
         if error == nil { 
          if let imageData = imageData { 
           self.ProfileImage.image = UIImage(data:imageData) 
          } 
         } 
        } 
       } 
      } 
     } else { 
      // Log details of the failure 
      print("Error: \(error!) \(error!.userInfo)") 
     } 
    }" 
+0

http://stackoverflow.com/questions/32645533/xcode-7-compile-error-command-failed-due-to-signal-segmentation-fault-11 該用戶恢復到xcode6並編譯它,但它不適合我。 – pmoney13

回答

2

:「命令失敗,原因是信號:段錯誤:11」導致的問題在我的應用程序...我的應用程序是依賴解析。我發現,解析所做的更改方法:

query.findObjectsInBackgroundWithBlock({ (objects : [AnyObject]?, error : NSError?) -> Void in 

query.findObjectsInBackgroundWithBlock({ (objects : [**PFObject**]?, error : NSError?) -> Void in 

我已經改變了這一切,而現在它的工作原理。希望這可以幫助使用Parse的人。感謝用戶Babac。

0

好回答這個問題是要改變梅索德:

query.findObjectsInBackgroundWithBlock({ (objects : [PFObject]?, error : NSError?) -> Void in 

這樣:

query.findObjectsInBackgroundWithBlock({ (objects : [AnyObject]?, error : NSError?) -> Void in 

,因爲改變的唯一事情就是[PFObject]?[AnyObject]?那麼你的代碼將正常工作; - )

相關問題