devxoul / RxReusable

Reusable cells and views for RxSwift
MIT License
23 stars 3 forks source link

UIImagePickerController can not select photo when using RxReusable #2

Open adgvcxz opened 7 years ago

adgvcxz commented 7 years ago

I started learning iOS and I've bean learning iOS and rxswift through your open source project.

However, I found that it will make the UIImagePickerController can not select photo.

let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = .photoLibrary
picker.allowsEditing = false
self.present(photoLib, animated: true, completion: nil)

but

didFinishPickingMediaWithInfo

not called

devxoul commented 7 years ago

Possibly duplicated with #1.

Could you please try with #3?

Podfile

pod 'URLNavigator', :git => 'https://github.com/devxoul/RxReusable', :branch => 'didmovetowindow'
adgvcxz commented 7 years ago

Thank you for your repley. Now it can select photo, but it caused another bug:

import UIKit
import Then
import SnapKit

class ViewController: UIViewController {

    fileprivate let emailFiled = UITextField().then {
        $0.placeholder = "Email"
        $0.textColor = .black
        $0.keyboardType = .emailAddress
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        self.view.addSubview(self.emailFiled)

        self.emailFiled.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.top.equalTo(20)
            make.height.equalTo(40)
        }

    }
}

When I press emailFiled the app will crash.

log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RxCocoa.RxCollectionViewDelegateProxy leftMarginForCollectionView:layout:]: unrecognized selector sent to instance 0x17008c850'
*** First throw call stack:
(0x18468afd8 0x1830ec538 0x184691ef4 0x18468ef4c 0x18458ad2c 0x18af67b6c 0x18a8163ec 0x18a8159f8 0x18a815460 0x18a7b7158 0x1879a7274 0x18799bde8 0x18a7cb8f0 0x18b19a41c 0x18b1a7cf0 0x18abe8124 0x18a8d2b40 0x18a7e4f74 0x18abe7dd4 0x18abdf264 0x18abdf07c 0x18a7e3ee8 0x184690e80 0x1845862b4 0x18a8ddc98 0x1846389a0 0x184636628 0x184636a74 0x184566d94 0x185fd0074 0x18a81f130 0x10005db48 0x18357559c)
libc++abi.dylib: terminating with uncaught exception of type NSException
devxoul commented 7 years ago

@adgvcxz, have you set delegate or something on emailFiled? I cannot reproduce it.

adgvcxz commented 7 years ago

@devxoul No, this is all my code

This is my Podfile:

platform :ios, '9.0'

target 'test' do
  use_frameworks!
  pod 'RxReusable', :git => 'https://github.com/devxoul/RxReusable', :branch => 'didmovetowindow'
  pod 'SnapKit'
  pod 'Then'
end

It will crash when i use iPhone to debug, but it works fine on the Simulator.

If I changed Podfile to this:

platform :ios, '9.0'

target 'test' do
  use_frameworks!
  pod 'RxReusable'
  pod 'SnapKit'
  pod 'Then'
end

Everything is fine, whether I use iPhone or Simulator

devxoul commented 7 years ago

@adgvcxz, hmm. That's weird. Can you try it again after deleting DerivedData? If the problem exists, can you share the project to me?