Ran both my app and unit tests that test rudimentary mapping of objects using ObjectMapper using Xcode 9 (tried both Swift 3.2 and Swift 4.0 versions) and it crashes in random places within ObjectMapper during mapping.
The exact same code with the exact same version of ObjectMapper runs fine when compiled with Xcode 8 (iOS 10 SDK).
App and unit tests properly run.
#0 0x0000000113e85800 in swift_beginAccess ()
#1 0x0000000108d99d56 in MyObject.myProperty.materializeForSet ()
#2 0x0000000108dad1e2 in MyObject.mapping(map:) at
It also indicates this error: "Simultaneous accesses to 0x%lx, but modification requires exclusive access"
The unit tests run just in one thread so I can rule out any kind of multithreading issue.
I am trying to troubleshoot this issue for multiple days without any luck. Does anyone else encounter the same problem?
Update: I noticed that my app and the unit test target had this setting
SWIFT_ENFORCE_EXCLUSIVE_ACCESS
set to "Full Enforcement".
Once I turned it off, the app didn't crash anymore.
Since you have resolved your issue I will close this. Thanks
@tristanhimmelman I haven't resolved the issue, I have worked around it. This is still a problem that need to be solved. By default, Xcode will set this compiler setting. So inside of ObjectMapper something happens that is now considered dangerous.
+1
+1
+1
+1
+1
Is there any update you can provide for this? Or is the project no longer maintained?
Looks like regular updates are being made to the repo. @tristanhimmelman any ETA on this issue since it seems to be impacting quite a large group of people.
@adamkuipers @falkobuttler, unfortunately I do not currently have time to look into this issue. If anybody has a PR with a fix I am happy to accept it.
@falkobuttler dont'see SWIFT_ENFORCE_EXCLUSIVE_ACCESS anywhere in our build settings. Do you just add this to 'Other Swift Flags'? Does it need a dash prepended? (ie: '-SWIFT_ENFORCE_EXCLUSIVE_ACCESS')
@marchy The option is called "Exclusive Access to Memory" (see screenshot):
@falkobuttler Ahh wonderful, found it!
You're a lifesaver =)
(And I guess it seems they only crash the app in debug builds – so life is still sane phhew!!)
Turning off enforcement won't prevent real crashes from happening in the wild. This setting you're changing is about always warning you when it could happen. Changing it has no impact on what happens when it does happen, which is almost always a crash.
Most helpful comment
@marchy The option is called "Exclusive Access to Memory" (see screenshot):