0

I am getting an error "Command failed due to signal: Segmentation fault: 11" at runtime. I believe this is a compile error because when I clean my code it does not have any errors, only when I run & build. I am using the new Xcode beta 7.1. I also built it through my Xcode 7.0 but received same error.

The Swift code has previously built with no errors. This code is dealing with a Parse backend and querying some info to display to a user; here is the logs below:

  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)")
        }
    }"
pmoney13
  • 1,075
  • 3
  • 11
  • 19
  • http://stackoverflow.com/questions/32645533/xcode-7-compile-error-command-failed-due-to-signal-segmentation-fault-11 This user reverted back to xcode6 and it compiled but it did not work for me. – pmoney13 Sep 21 '15 at 21:13

2 Answers2

2

I've searched why The error: "Command failed due to signal: Segmentation fault: 11" is causing problems in my app... My app is Parse dependent. I found out that Parse made changes to method:

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

to

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

I've changed it all, and now it works. Hope this will help someone using Parse. Thanks to user Babac.

pmoney13
  • 1,075
  • 3
  • 11
  • 19
0

The good answer for this question is to change the methode :

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

to this :

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

because the only thing to change is [PFObject]? to [AnyObject]? then your code will work fine ;-)