swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.6k stars 10.37k forks source link

[SR-10057] segmentation fault : 11 #52460

Open swift-ci opened 5 years ago

swift-ci commented 5 years ago
Previous ID SR-10057
Radar None
Original Reporter gani60 (JIRA User)
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 613cd58d3abcfc6f3ae7688b0b00e683

Issue Description:

Today i have migrated from Xcode 9.4 to Xcode and 10.1 and swift version is 4. But i am getting so many segmentation fault :11. How to identify line number and what is the cause .

Please can anybody know?

bc7072e8-7d37-4a38-8fee-cab463d443b7 commented 5 years ago

You should see what file is the primary cause for the crash from the build log. You could start removing parts of the source code to reduce. Hope this helps!

+ @xedin in case he has more suggestions

swift-ci commented 5 years ago

Comment by Ganesh Musini (JIRA)

Hi Pavel,

Thanks for replying, I have so many segmentation fault issues. I cannot identify line numbers or issues where i have. Can you please let me know how i can solve. Can we avoid segmentation issues?

xedin commented 5 years ago

gani60 (JIRA User) The only way we could help if we knew where in the source these crashes are happening. Would it be possible for you to attach your project? You can create a radar bugreport.apple.com and attach the project there, which I believe is not going to be publicly visible.

swift-ci commented 5 years ago

Comment by Ganesh Musini (JIRA)

Thanks Pavel. I will post bug. But can i know, can we submit build using 9.4 to appstore?

xedin commented 5 years ago

Sorry but I honestly don't know.

swift-ci commented 5 years ago

Comment by Ganesh Musini (JIRA)

Pavel, anyway thanks. If you have any solution please let me know on musiniganesh87@gmail.com

theblixguy commented 5 years ago

gani60 (JIRA User) No, you can't. https://developer.apple.com/app-store/submissions/

> Please note that Starting March 2019, all iOS apps submitted to the App Store will need to be built with the iOS 12.1 SDK or later, and support the all-screen design of iPhone XS Max or the 12.9-inch iPad Pro (3rd Generation). All watchOS apps will need to support watchOS 5 and Apple Watch Series 4.

You will need to use Xcode 10.1 to submit apps from now.

Please create a radar (on bugreport.apple.com) and attach your project with the report. Alternatively, you can attach it here if you want it to be publicly available for anyone to see.

swift-ci commented 5 years ago

Comment by Ganesh Musini (JIRA)

Hi Suyash,

Thanks for reply. Can i know how to solve "Command failed due to signal: Segmentation fault: 11" issue, please let me know

theblixguy commented 5 years ago

You need to either file a radar or attach your project here so someone can take a look.

swift-ci commented 5 years ago

Comment by Ganesh Musini (JIRA)

When i opened error log, at last i can see this,

2. While emitting SIL for 'tableView(_:cellForRowAt🙂' at /Users/ganesh/Documents/movieMEASURE/movieMEASURE/ViewControllers/ADchecks-Manual/SelectedADsViewController.swift:463:5

3. While silgen emitFunction SIL function "@$S12movieMEASURE25SelectedADsViewControllerC05tableE0_12cellForRowAtSo07UITableE4CellCSo0lE0C_10Foundation9IndexPathVtF".

for 'tableView(_:cellForRowAt🙂' at /Users/ganesh/Documents/movieMEASURE/movieMEASURE/ViewControllers/ADchecks-Manual/SelectedADsViewController.swift:463:5

so i assume that error in 463, but in that number i have following function starting of fuction is that line number

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let manualaddcheck = arrAdcheckcount\[indexPath.row\] as?NSDictionary

    if (manualaddcheck?\["Versiontype"\] as?String)! == TrailerVersion

    {

       // return self.getTrailerCellWith(rowNumber: indexPath.row)

        let cell:SelectedADsTableViewCell = self.selectedADsTableVC.dequeueReusableCell(withIdentifier: "selectedADsCell")![]( as) SelectedADsTableViewCell

        let manualaddcheck = arrAdcheckcount\[indexPath.row\] as? NSDictionary

        let status = Reach().connectionStatus()

        switch status {

        case .unknown, .offline:

            var imageName:String?

            if manualaddcheck?\["cover_image"\] != nil

            {

                imageName = UserDefaults().string(forKey: (manualaddcheck?\["cover_image"\] as? String![]()))

                if (imageName != nil)  {

                    var token = 0

                    token  = Int((imageName?.components(separatedBy: ".jpg").first)![]())

                    print(token as Any)

                    if token  == manualaddcheck?\["mq_movie_id"\] as? Int

                    {

                        //  print(CommonObjClass().getImageFromDocDir(imageName: imageName!))

                        if CommonObjClass().checkimage(imageName: imageName!) == false {

                            print("equal")

                            cell.AdsPoster.sd_setImage(with: URL(string:  (manualaddcheck?\["cover_image"\] as?AnyObject)!.trimmingCharacters(in: .whitespaces)), placeholderImage: UIImage(named: "sampleADposter.png"))

                        }

                        else

                        {

                            print("not equal")

                            cell.AdsPoster.image = CommonObjClass().getImageFromDocDir(imageName: imageName!)

                        }

                    }

                    else

                    {

                        cell.AdsPoster.sd_setImage(with: URL(string:  (manualaddcheck?\["cover_image"\] as?AnyObject)!.trimmingCharacters(in: .whitespaces)), placeholderImage: UIImage(named: "sampleADposter.png"))

                    }

                }

                else

                {

                    // cell.AdsPoster.sd_setImage(with: URL(string: manualaddcheck?\["cover_image"\] as! String), placeholderImage: UIImage(named: "sampleADposter.png"))

                    cell.AdsPoster.sd_setImage(with: URL(string:  (manualaddcheck?\["cover_image"\] as?AnyObject)!.trimmingCharacters(in: .whitespaces)), placeholderImage: UIImage(named: "sampleADposter.png"))

                    cell.AdsPoster.image = UIImage(named: "sampleADposter.png")

                }

            }

            else

            {

                cell.AdsPoster.image = UIImage(named: "sampleADposter.png")

            }

        case .online(.wwan):

            cell.AdsPoster.sd_setImage(with: URL(string:  (manualaddcheck?\["cover_image"\] as?AnyObject)!.trimmingCharacters(in: .whitespaces)), placeholderImage: UIImage(named: "sampleADposter.png"))

        case .online(.wiFi):

            cell.AdsPoster.sd_setImage(with: URL(string:  (manualaddcheck?\["cover_image"\] as?String![]()).trimmingCharacters(in: .whitespaces)), placeholderImage: UIImage(named: "sampleADposter.png"))

        }

        cell.AdsTitleAndSubTitleLabel.text = (manualaddcheck?\["movie_title"\] as?String)?.uppercased()

        cell.AdsTitleAndSubTitleLabel.textColor = UIColor.yellow

        cell.AdsCommentsOrNotesLabel .isHidden = false

        cell.AdsPoster.sd_setShowActivityIndicatorView(true)

        cell.AdsPoster.sd_setIndicatorStyle(.white)

        cell.AdsPoster . backgroundColor = UIColor .clear

        cell.AdsPoster .contentMode = .scaleToFill

        print(manualaddcheck?\["custom_name"\]! as Any)

        var fullStr = NSString(format:"Version : %@ ",((manualaddcheck?\["custom_name"\]) as?String?)!!)

        var boldStr = NSString(format:"%@ ",((manualaddcheck?\["custom_name"\]) as?String?)!!)

        if ((manualaddcheck?\["custom_name"\]) as?String?) == "" \|\| ((manualaddcheck?\["custom_name"\]) as?String?) == nil {

            fullStr = ""

            boldStr = ""

        }

        //  let versionAttributedText:NSMutableAttributedString = CommonObjClass().addBoldText(fullString: fullStr, boldPartOfString:boldStr as NSString, font: normalFont16, boldFont: boldFont16) as! NSMutableAttributedString

        let versionAttributedText:NSMutableAttributedString = CommonObjClass().addColourToText(fullString: fullStr as String, fullStringColor: UIColor.white, subString: boldStr as String, subStringColor: UIColor.yellow)

        if manualaddcheck?\["comment"\] as?String == "" \|\| manualaddcheck?\["comment"\] as?String == nil

        {

            fullStr = ""

            boldStr = ""

        }

        else

        {

            //            fullStr = NSString(format:"\nComments: %@ ",(manualaddcheck?\["comment"\] as?String)!)

            //            if UIDevice().screenType == .iPhone6Plus

            //            {

            //                if (((manualaddcheck?\["comment"\] as?String)? .characters.count)! \<= 30) {

            //                    fullStr = NSString(format:"\nComments: %@ \n\n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //                else

            //                {

            //                    fullStr = NSString(format:"\nComments: %@ \n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //            }

            //            else if UIDevice().screenType == .iPhone6

            //            {

            //                if (((manualaddcheck?\["comment"\] as?String)? .characters.count)! \<= 25) {

            //                    fullStr = NSString(format:"\nComments: %@ \n\n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //                else

            //                {

            //                    fullStr = NSString(format:"\nComments: %@ \n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //            }

            //            else if UIDevice().screenType == .iPhone5 \|\|  UIDevice().screenType == .iPhone4

            //            {

            //                if (((manualaddcheck?\["comment"\] as?String)? .characters.count)! \<= 22) {

            //                    fullStr = NSString(format:"\nComments: %@ \n\n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //                else

            //                {

            //                    fullStr = NSString(format:"\nComments: %@ \n",(manualaddcheck?\["comment"\] as?String)!)

            //                }

            //

            //            }

            fullStr = self.getFullStringFrom(addCheck: manualaddcheck!) as NSString

            boldStr = NSString(format:"%@",(manualaddcheck?\["comment"\] as?String)!) as String as NSString

        }

        let commentAttributedText:NSMutableAttributedString = CommonObjClass().addBoldText(fullString: fullStr, boldPartOfString:boldStr as NSString, font: normalFont16, boldFont: boldFont16) as! NSMutableAttributedString

        if (manualaddcheck?\["trailer_format"\] as![]( String) )= ""

        {

            let strtype: NSString = NSString(format: " %@", (manualaddcheck?\["trailer_format"\] as! String))

            let trailerFormat = NSString(format:"\n2D/3D: %@ \n",strtype)

            let formatAttributedString:NSMutableAttributedString = CommonObjClass().addBoldText(fullString: trailerFormat, boldPartOfString:strtype as NSString, font: normalFont16, boldFont: boldFont16) as! NSMutableAttributedString

            let strfirst =  formatAttributedString.string.appending(commentAttributedText.string)

            let strtotal = versionAttributedText.string.appending(strfirst)

            //                formatAttributedString.append(commentAttributedText)

            //

            //                versionAttributedText.append(formatAttributedString)

            if manualaddcheck?\["comment"\] as?String == "" \|\| manualaddcheck?\["comment"\] as?String == nil

            {

                if CommonObjClass().heightForView(text: strtotal, font: boldFont16, width: cell.AdsCommentsOrNotesLabel.frame.width) \<=  50

                {

                    fullStr = ""

                    fullStr = "\n\n"

                }

                else

                {

                    fullStr = "\n"

                }

                let commentAttributedText:NSMutableAttributedString = CommonObjClass().addBoldText(fullString: fullStr, boldPartOfString:boldStr as NSString, font: normalFont16, boldFont: boldFont16) as! NSMutableAttributedString

                formatAttributedString.append(commentAttributedText)

                versionAttributedText.append(formatAttributedString)

            }

            else

            {

                formatAttributedString.append(commentAttributedText)

                versionAttributedText.append(formatAttributedString)

            }

            //            formatAttributedString.append(commentAttributedText)

            //

            //            versionAttributedText.append(formatAttributedString)

        }

        else

        {

            versionAttributedText.append(commentAttributedText);

        }

        cell.AdsCommentsOrNotesLabel.attributedText = versionAttributedText

        cell.AddADOutlet.tag = indexPath.row

        return cell;

    }

    else

    {

        return self.getAdsCellWith(indexPath: indexPath)

    }

}