Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Segmentation Fault 11 #21

Closed
jjeon5 opened this issue Apr 12, 2015 · 10 comments
Closed

Swift Segmentation Fault 11 #21

jjeon5 opened this issue Apr 12, 2015 · 10 comments

Comments

@jjeon5
Copy link

jjeon5 commented Apr 12, 2015

After properly adding the pod and putting

class AppDelegate: UIResponder, UIApplicationDelegate {
    lazy var window: COSTouchVisualizerWindow? = {
        COSTouchVisualizerWindow(frame: UIScreen.mainScreen().bounds)
        }()
   ...
}

There is a segmentation fault

error: use of undeclared type 'COSTouchVisualizerWindow'
    lazy var window: COSTouchVisualizerWindow? = {
                     ^~~~~~~~~~~~~~~~~~~~~~~~
0  swift                    0x0000000101cd8968 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x0000000101cd8e54 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff88cb1f1a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000000000040 _sigtramp + 1999954240
4  swift                    0x000000010209dea2 mapSignatureFunctionType(swift::ASTContext&, swift::Type, bool, bool, bool, unsigned int) + 66
5  swift                    0x000000010209dcf3 swift::ValueDecl::getOverloadSignature() const + 531
6  swift                    0x0000000101fb35cd checkRedeclaration(swift::TypeChecker&, swift::ValueDecl*) + 397
7  swift                    0x0000000101fad073 swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 2723
8  swift                    0x0000000101f9df0b swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 123
9  swift                    0x0000000101f8425a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, unsigned int) + 1514
10 swift                    0x00000001012b95dd swift::CompilerInstance::performSema() + 2381
11 swift                    0x000000010101e788 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2008
12 swift                    0x000000010101c86d main + 1677
13 libdyld.dylib            0x00007fff8d0405c9 start + 1
14 libdyld.dylib            0x000000000000005e start + 1929116310
@joeblau
Copy link
Collaborator

joeblau commented Apr 12, 2015

Can you post the snippet of your AppDelegate?

Also are you using Frameworks with pods or a bridging header?

@jjeon5
Copy link
Author

jjeon5 commented Apr 12, 2015

Pods
I also commented out the original window.

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    lazy var window: COSTouchVisualizerWindow? = {
        COSTouchVisualizerWindow(frame: UIScreen.mainScreen().bounds)
        }()
    //var window: UIWindow?

@jjeon5
Copy link
Author

jjeon5 commented Apr 13, 2015

Any luck?

@joeblau
Copy link
Collaborator

joeblau commented Apr 13, 2015

Not yet, I was investigating it but I couldn't even get the window to load in Xcode 6.3. I'm getting a compile time error about overriding the getter on window.

What version of Xcode/Swift
Does your Podfile contain the use_frameworks! declaration ?

@jjeon5
Copy link
Author

jjeon5 commented Apr 13, 2015

I'm using Xcode 6.2 right now.
About the use_frameworks!, no I am unaware of this. Sorry I'm quite new to Cocoapods.

@joeblau
Copy link
Collaborator

joeblau commented Apr 13, 2015

Okay,

Apple might have changed something in Xcode 6.3 in the Swift formatting that is breaking my project which is why I can't run it right now. I'll have to trouble shoot that first.

As for use_frameworks!, that takes advantage of Apple's support for having proper bundled packages. Framework support was added in the latest minor release version of Cocoapods (0.36.0). If you're not using frameworks, then you're importing the COSTouchVisualizer through a bridging header.

Once I figure out why I can't use this library in Swift 1.2, I'm going to take a look at whether or not the bridging header makes a difference or not.

@KeiroMidori
Copy link

I can confirm this issue with the latest swift update. Hope you can find what's going on !

@dzdora
Copy link

dzdora commented May 23, 2015

I am having the same issue. Importing COSTouchVisualizer through a Bridging header. The error I'm getting is as follows:

Objective-C method 'window' provided by getter for 'window' conflicts with optional requirement getter for 'window' in protocol 'UIApplicationDelegate'

as well as for the setter

Objective-C method 'setWindow:' provided by setter for 'window' conflicts with optional requirement setter for 'window' in protocol 'UIApplicationDelegate'

I'm getting these both with and without use_frameworks!

@krusche
Copy link

krusche commented May 27, 2015

Use the following in your AppDelegate

    lazy var window: UIWindow? = {
        COSTouchVisualizerWindow(frame: UIScreen.mainScreen().bounds)
    }()

Then it should work without problems

@joeblau
Copy link
Collaborator

joeblau commented May 27, 2015

@krusche thank you, I was trying that but I forgot the step of setting the delegate. I just updated the project with a Swift example and here is the entire AppDelegate

import UIKit
import COSTouchVisualizer

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, COSTouchVisualizerWindowDelegate {

    lazy var window: UIWindow? = {
        var customWindow = COSTouchVisualizerWindow(frame: UIScreen.mainScreen().bounds)
        customWindow.touchVisualizerWindowDelegate = self
        return customWindow
        }()

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        return true
    }

    func touchVisualizerWindowShouldAlwaysShowFingertip(window: COSTouchVisualizerWindow!) -> Bool {
        return true
    }
}

joeblau added a commit that referenced this issue May 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants