Giter Club home page Giter Club logo

Comments (10)

evermeer avatar evermeer commented on June 9, 2024 1

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

from alamofirejsontoobjects.

BeBetter7 avatar BeBetter7 commented on June 9, 2024 1

I created a completely new project and moved my files to that one. Same settings and it worked. Sorry for the late answer.

from alamofirejsontoobjects.

BeBetter7 avatar BeBetter7 commented on June 9, 2024

Hi. I just use EVReflection and AlamofireJsonToObjects. Do I have to do this?

from alamofirejsontoobjects.

BeBetter7 avatar BeBetter7 commented on June 9, 2024

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.

screen shot 2016-09-26 at 15 38 08

from alamofirejsontoobjects.

evermeer avatar evermeer commented on June 9, 2024

The most common cause of this error is one of these:

  • array of nullable objects
  • using generic object in an array

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.

from alamofirejsontoobjects.

BeBetter7 avatar BeBetter7 commented on June 9, 2024

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.

from alamofirejsontoobjects.

evermeer avatar evermeer commented on June 9, 2024

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)

from alamofirejsontoobjects.

BeBetter7 avatar BeBetter7 commented on June 9, 2024

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.

from alamofirejsontoobjects.

evermeer avatar evermeer commented on June 9, 2024

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?

from alamofirejsontoobjects.

evermeer avatar evermeer commented on June 9, 2024

Is this still an issue?

from alamofirejsontoobjects.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.