Closed BeBetter7 closed 8 years ago
Hi, one question, are you using a framework to hold your data models? If so, then you should initialise it by calling a function like: EVReflection.setBundleIdentifier(Forecast) P.S. You could also add multiple frameworks
Hi. I just use EVReflection and AlamofireJsonToObjects. Do I have to do this?
Hi again. I'm testing your test class and I'm getting error in that. I imported Alamofire,EVReflection and AlamofireJsonToObjects pods in TestClass. And My pod file like this, platform :ios, '9.0' use_frameworks! target 'ProjectA' do pod 'Alamofire', '3.5.0' pod 'AlamofireJsonToObjects' pod 'EVReflection' pod 'ObjectMapper', '1.4.0' pod 'SwiftEventBus' pod 'AlamofireObjectMapper', '3.0.2' pod 'Kingfisher', '~> 1.8' pod 'Player', '~> 0.1.3' pod 'SCLAlertView' pod 'MBProgressHUD' pod 'Fabric' pod 'TwitterKit' pod 'TwitterCore' pod 'MobilePlayer' pod 'PureLayout' pod 'SwiftyJSON', '~> 2.0' pod 'SwiftKeychainWrapper' pod 'KeyClip' end
target 'ProjectATests' do pod 'Alamofire', '3.5.0' pod 'AlamofireJsonToObjects' pod 'EVReflection' pod 'ObjectMapper', '1.4.0' pod 'SwiftEventBus' pod 'AlamofireObjectMapper', '3.0.2' pod 'Kingfisher', '~> 1.8' pod 'Player', '~> 0.1.3' pod 'SCLAlertView' pod 'MBProgressHUD' pod 'Fabric' pod 'TwitterKit' pod 'TwitterCore' pod 'MobilePlayer' pod 'PureLayout' pod 'SwiftyJSON', '~> 2.0' pod 'SwiftKeychainWrapper' pod 'KeyClip' end `
and versions Using Alamofire (3.5.0) Using AlamofireJsonToObjects (1.6.0) Using AlamofireObjectMapper (3.0.2) Using EVReflection (2.46.0) Using Fabric (1.6.8) Using KeyClip (1.3.3) Using Kingfisher (1.9.3) Using MBProgressHUD (1.0.0) Using MobilePlayer (1.1.5) Using ObjectMapper (1.4.0) Using Player (0.1.3) Using PureLayout (3.0.2) Using SCLAlertView (0.6.0) Using SwiftEventBus (1.1.0) Using SwiftKeychainWrapper (2.0.0) Using SwiftyJSON (2.4.0) Using TwitterCore (2.4.0) Using TwitterKit (2.4.0)
And now I'm getting following error in Evreflection. I couldn't solved this problem. Please help me.
The most common cause of this error is one of these:
There is a workaround available for that. You have to implement the EVArrayConvertable protocol. This means that you have to implement the function: func convertArray(_ key: String, array: Any) -> NSArray For a sample see: https://github.com/evermeer/EVReflection/blob/Swift3/EVReflection/EVReflectionTests/EVReflectionWorkaroundsTests.swift#L180
If it's not this, then I need more information for solving this. Usually the class structures plus a json will be enough.
First of all, I really thank you for your interest and quick answers. Secondly now I am just using your test class, models and json but I'm getting this error.
That's strange... Then that could only happen when there is a bundle identifier mis match. Usually this could be corrected by using: EVReflection.setBundleIdentifier(YourClassHere)
I do use code for fixing bundle identifier names with special characters. Maybe you are using unhandled special characters. What do you get if you print this: print(Bundle(for: type(of: YourClassHere())).infoDictionary?[kCFBundleNameKey as String] as? String ?? "") print(Bundle(for: type(of: YourClassHere())).bundleIdentifier)
Hey. I changed versions and remove some pods . As a result I solved my problem in Unit Test class. But in ViewController class I'm still getting "Could not create an instance for type Forecast" error. In ViewController class I added "EVReflection.setBundleIdentifier(Forecast)" before request call but nothing is changed. This is same error I got when I removed EVReflection.setBundleIdentifier(Forecast) from unit test.
are you sure that the name of your bundle does not have any special characters? what is the CFBundleName in your .plist? Is it set to $(PRODUCT_NAME) ? What do you have in your targets display name?
Is this still an issue?
I created a completely new project and moved my files to that one. Same settings and it worked. Sorry for the late answer.
Hi. I used your library my old project and it was very helpful for me. Thank you.
Now I'm using your library again. But I faced a problem this time. I suspected my model class and because of that I used your example for the test.
I got this error "Could not create an instance for type Forecast".
now my versions :
xcode : 7.3.1 pod version : 1.0.1 imported some pods : Alamofire (3.5.0) AlamofireJsonToObjects (1.6.0) EVReflection (2.46.0)
I think this is about versions but I dont know. Do you have any idea about that? Thanks.