MKMapViewDelegate command failed due to signal: Segmentation Error: 11

I have a very strange problem with MKMapViewDelegate when I implement this method, give me an error that I don't understand

The error disappears when I delete the whole function,

I tried to make an empty function returning zero, but give me the same error.

func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! { if annotation.isKindOfClass(MKUserLocation.classForCoder()) { return nil } let AnnotationIdentifier:NSString = "AnnotationIdentifier" var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(AnnotationIdentifier) if annotationView != nil { return annotationView }else { var annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: AnnotationIdentifier) annotationView.canShowCallout = true annotationView.image = UIImage(named: "btn_fav.png") return annotationView } } 

Error: The command could not be completed due to a signal: Segmentation error: 11

 CompileSwift normal arm64 /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Vistas/Proyecto/MapaViewController.swift cd /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c "/Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Classes/NetClass/Downloader.swift" -primary-file "/Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Vistas/Proyecto/MapaViewController.swift" "/Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Vistas/Widget/ToggleView.swift" . 

. ,.

 0 swift 0x00000001019df028 llvm::sys::PrintStackTrace(__sFILE*) + 40 1 swift 0x00000001019df514 SignalHandler(int) + 452 2 libsystem_platform.dylib 0x00007fff9a2dc5aa _sigtramp + 26 3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1708276336 4 swift 0x0000000100fe90ea swift::ClangImporter::Implementation::loadAllMembers(swift::Decl const*, unsigned long long, bool*) + 3130 5 swift 0x0000000101da2834 swift::IterableDeclContext::loadAllMembers() const + 100 6 swift 0x0000000101d995dc swift::NominalTypeDecl::getMembers(bool) const + 28 7 swift 0x0000000101dc029f swift::NominalTypeDecl::lookupDirect(swift::DeclName) + 79 8 swift 0x0000000101dbe96a swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3146 9 swift 0x0000000100fe5941 (anonymous namespace)::SwiftDeclConverter::VisitObjCPropertyDecl(clang::ObjCPropertyDecl const*, swift::DeclContext*) + 161 10 swift 0x0000000100fe0d0d clang::declvisitor::Base<clang::declvisitor::make_const_ptr, (anonymous namespace)::SwiftDeclConverter, swift::Decl*>::Visit(clang::Decl const*) + 3117 11 swift 0x0000000100fe005b swift::ClangImporter::Implementation::importDeclImpl(clang::NamedDecl const*, bool&, bool&) + 331 12 swift 0x0000000100fe4912 swift::ClangImporter::Implementation::importDeclAndCacheImpl(clang::NamedDecl const*, bool) + 226 13 swift 0x0000000100fe879e swift::ClangImporter::Implementation::loadAllMembers(swift::Decl const*, unsigned long long, bool*) + 750 14 swift 0x0000000101da2834 swift::IterableDeclContext::loadAllMembers() const + 100 15 swift 0x0000000101d99a95 swift::ExtensionDecl::getMembers(bool) const + 21 16 swift 0x0000000101dc027d swift::NominalTypeDecl::lookupDirect(swift::DeclName) + 45 17 swift 0x0000000101dbe96a swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3146 18 swift 0x0000000101cc6288 swift::TypeChecker::lookupMember(swift::Type, swift::DeclName, swift::DeclContext*, bool) + 200 19 swift 0x0000000101c34e2c swift::constraints::ConstraintSystem::lookupMember(swift::Type, swift::DeclName) + 220 20 swift 0x0000000101c6b32d swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 2173 21 swift 0x0000000101c6dc88 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 216 22 swift 0x0000000101c354bc swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 28 23 swift 0x0000000101c5a8a5 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) + 9317 24 swift 0x0000000101c5c502 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 162 25 swift 0x0000000101d6627f (anonymous namespace)::Traversal::visit(swift::Expr*) + 6431 26 swift 0x0000000101d62765 swift::Expr::walk(swift::ASTWalker&) + 53 27 swift 0x0000000101c583b0 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 96 28 swift 0x0000000101c90ab6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::Type, bool, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*) + 518 29 swift 0x0000000101cd73e3 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 291 30 swift 0x0000000101cd64c3 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 371 31 swift 0x0000000101cd6b8f swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 95 32 swift 0x0000000101c86b65 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 421 33 swift 0x0000000101c87476 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, unsigned int) + 1734 34 swift 0x0000000100fc07dd swift::CompilerInstance::performSema() + 2253 35 swift 0x0000000100d54831 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 1953 36 swift 0x0000000100d5294d main + 1677 37 libdyld.dylib 0x00007fff960e05fd start + 1 38 libdyld.dylib 0x0000000000000061 start + 1777465957 Stack dump: 0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Classes/NetClass/Downloader.swift -primary-file /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Vistas/Proyecto/MapaViewController.swift /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Vistas/Widget/ToggleView.swift /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Classes/Entities/Mapa.swift /Users/Fortis/Proyectos/IOS Apps/Abilia/Abilia iOS/Abilia/Abilia/Classes/Entities/Edificio__c.swift . 

. ,,, 1. When checking the type 'loadMapa' in / Users / Fortis / Proyectos / IOS Apps / Abilia / Abilia iOS / Abilia / Abilia / Vistas / Proyecto / MapaViewController.swift: 56: 5 2. While the validation expression types in [/ Users / Fortis / Proyectos / IOS Apps / Abilia / Abilia iOS / Abilia / Abilia / Vistas / Proyecto / MapaViewController.swift: 57: 9 - line: 57: 29] RangeText = "mapaView.delegate = s"

 func loadMapa () { mapaView.delegate = self var theCoord = CLLocationCoordinate2DMake(0, 0) if let coordenadasU = coordenadas { let coordArray:[NSString] = coordenadasU.componentsSeparatedByString(",") as [NSString] if coordArray.count > 1 { let lat: CLLocationDegrees = coordArray[0].doubleValue; let long: CLLocationDegrees = coordArray[1].doubleValue; theCoord = CLLocationCoordinate2DMake(lat, long) } } pointAnnotation.coordinate = theCoord; mapaView.addAnnotation(pointAnnotation) let span = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1) let region:MKCoordinateRegion = MKCoordinateRegion(center: theCoord, span: span) mapaView.setRegion(region, animated: true) mapaLoaded = true; } 
+5
source share
4 answers

This is one of the quick errors that caused the compiler to crash unexpectedly because certain code is not working in your application.

You must isolate the problem part (for example, by commenting out parts of the screen), and after it compiles again, find a workaround for using different code.

What does your loadMapa method loadMapa ? This is the reason the compiler talked about.

+6
source

I had the same error while subclassing UIButton and overriding the selected property as follows:

 class ActionButton: UIButton { override var selected: Bool = true { didSet { updateBackgroundColor() } } } 

The solution was to remove '= true' from the override statement:

 class ActionButton: UIButton { override var selected: Bool { didSet { updateBackgroundColor() } } } 

I just guess, but I would double check if you implemented your delegation method correctly ... Given all the exclamation points ... '!' at the end of MKAnnotationView! seems a little suspicious.

+2
source

I searched for the cause of the error: "Command error due to signal: segmentation error: 11" causes problems in my application ... My application depends on the analysis. I found out that Parse made changes to the method:

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

to

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

I changed everything, and now it works. Hope this helps someone use Parse. Greetings

+1
source

Not a very specific answer, but I wanted to add another possible reason for this error (since it is still quite common).

My program had this code:

 if (myArray.count > 0) && (.Foo != myArray.last) { // Do something } 

In my case, .Foo belonged to an enumeration for which I implemented Equatable , however, for some reason, the Swift compiler did not highlight my comparison with myArray.last as an error (not optional compared to optional) and caused a segmentation error.

In my case, the fix was just to use myArray.last! , since myArray.count > 0 ensures that it will always succeed (there must be at least one element).

As usual, as soon as you know what the error is, be sure to bug report.apple.com it to bug report.apple.com !

0
source

Source: https://habr.com/ru/post/1203761/


All Articles