My project works fine on one MacBook, but after I transfering it to another MacBook, it crashes.Here is a part of my code:func MusicPlay()
{
Playnow = true
self.ipv.start()
self.playButton.isHidden = true
self.pauseButton.isHidden = false
var path = Bundle.main.path(forResource:music!,ofType :"mp3")
if Initial == true{
path = Bundle.main.path(forResource:music!,ofType :"mp3")
}
else{
switch music {
case "Viva La Vida":
path = Bundle.main.path(forResource:"result1",ofType :"mp3")
case "Something Just Like This":
path = Bundle.main.path(forResource:"result2",ofType :"mp3")
case "Señorita":
path = Bundle.main.path(forResource:"result3",ofType :"mp3")
default:
path = Bundle.main.path(forResource:music!,ofType :"mp3")
}
}
let soundUr1 = URL(fileURLWithPath: path!)
do{
try audioPlayer = AVAudioPlayer(contentsOf: soundUr1)
audioPlayer.volume = 1.0
audioPlayer.numberOfLoops = -1
audioPlayer.delegate = self
audioPlayer.play()
} catch{
print(error)
}
}After choosing a music at tableView, it performs the function "MusicPlay",and then the project crashes at line 26:try audioPlayer = AVAudioPlayer(contentsOf: soundUr1)Error message:2020-02-15 22:47:22.013016+0800 InteractivePlayerView[6645:253620] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000004d7120> F8BB1C28-BAE8-11D6-9C31-00039315CD46What should I do to address this problem?
Post
Replies
Boosts
Views
Activity
When I run my project,it crashes quickly,with error message:"Unknown class _TtC10Soul_Music27CollectionViewSlantedLayout in Interface Builder file.""Soul_Music" is the name of my project and "CollectionViewSlantedLayout" is a class at my project.I'm sure that there is no class called "_TtC10Soul_Music27CollectionViewSlantedLayout".How to address this problem?Thanks in advance.
I am working on show weather project. I am listing the cities from database. When I click on a city, another viewcontroller should open. But when I click on a city, the didSelectRowAtIndexPath function does not work.Here is the my code:import UIKit
import SCLAlertView
import Popover
class UserInfoViewController: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate{
fileprivate var texts = ["Los Angeles", "New York", "Chicago"]
fileprivate var popover: Popover!
fileprivate var popoverOptions: [PopoverOption] = [
.type(.auto),
.blackOverlayColor(UIColor(white: 0.0, alpha: 0.6))
]
@IBOutlet var compositionNum: UILabel!
@IBOutlet var fans: UILabel!
@IBOutlet var location: UILabel!
@IBOutlet var userName: UILabel!
@IBOutlet var userImag: UIImageView!
@IBOutlet var imagBt: UIButton!
@IBAction func modifyInfo(_ sender: Any) {
let alert = SCLAlertView()
let textField1 = alert.addTextField(userName.text)
let textField2 = alert.addTextField(location.text)
alert.addButton(“Done”)
}
}
@IBOutlet var topButton: UIButton!
@IBAction func expandSet(_ sender: Any) {
self.popover = Popover(options: self.popoverOptions)
let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width-250, height: 120))
tableView.delegate = self
tableView.dataSource = self
tableView.isScrollEnabled = false
tableView.allowsSelection = true
self.popover.show(tableView, fromView: self.topButton)
}
@IBAction func modifyImag(_ sender: Any) {
showBottomAlert()
}
override func viewDidLoad() {
super.viewDidLoad()
view.bringSubviewToFront(userImag)
view.bringSubviewToFront(imagBt)
}
func photos() {
self.showBottomAlert()
}
func showBottomAlert(){
let alert = SCLAlertView()
}
func goCamera(){
if UIImagePickerController.isSourceTypeAvailable(.camera){
let cameraPicker = UIImagePickerController()
cameraPicker.delegate = self
cameraPicker.allowsEditing = true
cameraPicker.sourceType = .camera
self.present(cameraPicker, animated: true, completion: nil)
} else {
SCLAlertView().showError("",subTitle: "",closeButtonTitle: "")
}
}
func goImage(){
let photoPicker = UIImagePickerController()
photoPicker.delegate = self
photoPicker.allowsEditing = true
photoPicker.sourceType = .photoLibrary
self.present(photoPicker, animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let image : UIImage = info[UIImagePickerController.InfoKey.editedImage] as! UIImage
userImag.image = image
userImag.layer.cornerRadius = userImag.frame.size.width / 2
self.dismiss(animated: true, completion: nil)
}
}
extension String{
var isBlank:Bool{
return allSatisfy({$0.isWhitespace})
}
}
extension UserInfoViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.popover.dismiss()
}
}
extension UserInfoViewController: UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
cell.textLabel?.text = self.texts[(indexPath as NSIndexPath).row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) {
if(indexPath.row == 0){
let storyboard = UIStoryboard(name: "Main", bundle: nil)
guard let secondVC = storyboard.instantiateViewController(withIdentifier: "Main") as? MainViewController else { return }
self.present(secondVC, animated: true, completion: nil)
}
else if(indexPath.row == 1){
}
else{
}
}
}What should I do to make it correct?Thanks in advance.