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

required public init() #39

Closed
mamondejy opened this issue Jan 11, 2023 · 5 comments
Closed

required public init() #39

mamondejy opened this issue Jan 11, 2023 · 5 comments
Assignees

Comments

@mamondejy
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

required public init() {
    fatalError("init() has not been implemented")
}

this occurs an error “Thread 1: Fatal error: init(coder:) has not been implemented”

Expected behavior

shouldn't it be changed to like below?

required public init?(coder decoder: NSCoder){
fatalError("init(coder:) has not been implemented")
}

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • iOS Version : 15.6
  • Device Information : iPad Pro(12.9)(4th)
  • macOS Version : 13.1
  • Xcode Version : 14.2

Additional context

@maxxfrazer
Copy link
Owner

the intention is that the empty initialiser shouldn't be used, instead when created the focusentity should already have a reference to the ARView:

https://maxxfrazer.github.io/FocusEntity/documentation/focusentity/focusentity/init(on:focus:)

@mamondejy
Copy link
Author

mamondejy commented Jan 11, 2023

Thank you for your reply.
I'm a beggnier and testing a sample code referring to 'https://youtu.be/9R_G0EI-UoI'

I wrote like below and the whole code were builded successfully.

class CustomARView: ARView{
let focusSquare = FocusEntity()
required init(frame frameRect: CGRect) {
super.init(frame: frameRect)
focusSquare.viewDelegate = self
focusSquare.delegate = self
focusSquare.setAutoUpdate(to: true)
self.setupARView()
}
required init?(coder decoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupARView(){
let config = ARWorldTrackingConfiguration()
config.planeDetection = [.horizontal, .vertical]
config.environmentTexturing = .automatic
if ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh){
config.sceneReconstruction = .mesh
}
self.session.run(config)
}
}

Nevertheless the error, Thread 1: Fatal error: init() has not been implemented, occurred on FocusEntity.swift's line 288.

It would be grateful if you could help me with this problem.

@maxxfrazer
Copy link
Owner

Hi, I remember in Ryan's video (the one you linked), he does specify that he's using a specific package version, which is older than the current latest version of 2.3.0

Check out the example which is included in this repo for up-to-date usage, otherwise make sure you're using the same version as in the video.

@mamondejy
Copy link
Author

Thank you Maxx, I've imported the same version of package and builded successfully. However I cannot see a square focus on my ipad.
in this case, which part should I look into? (the init works.)

@maxxfrazer
Copy link
Owner

Ryan runs through the additional steps after initialisation in his video.
I’d recommend just cloning this repository and taking a look at the example project, which contains a working example with a few changeable parameters.

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

2 participants