tristanhimmelman / AlamofireObjectMapper

An Alamofire extension which converts JSON response data into swift objects using ObjectMapper
MIT License
2.66k stars 474 forks source link

AlamofireObjectMapper 4.x - SIGBART Exception #189

Closed ozgur closed 7 years ago

ozgur commented 7 years ago

Here is my model:

import ObjectMapper

class IPAddress: Mappable {

  var address: String?

  required init?(map: Map) {
  }

  func mapping(map: Map) {
    address <- map["origin"]
  }
}

And when I do the following request, I get SIGBART in line 74:

Alamofire.request("http://httpbin.org/ip", method: .get)
  .responseJSON(completionHandler: { data in
    print("Data", data)
  })
  .responseObject(completionHandler: { (response: DataResponse<IPAddress>) in
    print("Response:", response)
  })

.responseJSON correctly prints the response data as dictionary.

Just did the following and it works fine:

Mapper<IPAddress>(context: nil).map(JSONObject: ["origin": "192.168.1.1"])

Tested with 4.0.0 and 4.0.1 via carthage. I am using Swift 3.0 and Xcode 8.2.1. (Tested with iPhone 5s 10.2.1)

Tested on simulator and got the following error:

dyld: lazy symbol binding failed: Symbol not found: __TFC12ObjectMapper6MapperCfT7contextGSqPS_10MapContext___GS0_x_
  Referenced from: /Users/ozgur/Library/Developer/CoreSimulator/Devices/EB73481B-51CD-4138-B4E2-CC8014F7F7F1/data/Containers/Bundle/Application/5B26A070-18FA-4768-8391-F9BD8C59A1EB/TestApp.app/Frameworks/AlamofireObjectMapper.framework/AlamofireObjectMapper
  Expected in: /Users/ozgur/Library/Developer/CoreSimulator/Devices/EB73481B-51CD-4138-B4E2-CC8014F7F7F1/data/Containers/Bundle/Application/5B26A070-18FA-4768-8391-F9BD8C59A1EB/TestApp.app/Frameworks/ObjectMapper.framework/ObjectMapper

dyld: Symbol not found: __TFC12ObjectMapper6MapperCfT7contextGSqPS_10MapContext___GS0_x_
  Referenced from: /Users/ozgur/Library/Developer/CoreSimulator/Devices/EB73481B-51CD-4138-B4E2-CC8014F7F7F1/data/Containers/Bundle/Application/5B26A070-18FA-4768-8391-F9BD8C59A1EB/TestApp.app/Frameworks/AlamofireObjectMapper.framework/AlamofireObjectMapper
  Expected in: /Users/ozgur/Library/Developer/CoreSimulator/Devices/EB73481B-51CD-4138-B4E2-CC8014F7F7F1/data/Containers/Bundle/Application/5B26A070-18FA-4768-8391-F9BD8C59A1EB/TestApp.app/Frameworks/ObjectMapper.framework/ObjectMapper

Here is the similar SO question suffering from the very same issue:

http://stackoverflow.com/questions/41507502/alamofireobjectmapper-swift-line-74-works-in-playground-but-not-on-device-or-emu

ozgur commented 7 years ago

Found out that the problem was about https://github.com/Hearst-DD/ObjectMapper/issues/722

Answered in: http://stackoverflow.com/questions/41507502/alamofireobjectmapper-swift-line-74-works-in-playground-but-not-on-device-or-emu/42126026#42126026

Keeping it open so others might find it useful. @tristanhimmelman you can close it anytime you want.

Cheers.

tristanhimmelman commented 7 years ago

I've just release an update which resolves the issue. Please let me know if the problem persists.

https://github.com/tristanhimmelman/AlamofireObjectMapper/releases/tag/4.0.2