{"action":"created","issue":{"url":"https://api.github.com/repos/SnapKit/SnapKit/issues/332","repository_url":"https://api.github.com/repos/SnapKit/SnapKit","labels_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/332/comments","events_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/332/events","html_url":"https://github.com/SnapKit/SnapKit/issues/332","id":178776324,"number":332,"title":"Cannot update constraint","user":{"login":"phamquochoan","id":3321851,"avatar_url":"https://avatars.githubusercontent.com/u/3321851?v=3","gravatar_id":"","url":"https://api.github.com/users/phamquochoan","html_url":"https://github.com/phamquochoan","followers_url":"https://api.github.com/users/phamquochoan/followers","following_url":"https://api.github.com/users/phamquochoan/following{/other_user}","gists_url":"https://api.github.com/users/phamquochoan/gists{/gist_id}","starred_url":"https://api.github.com/users/phamquochoan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phamquochoan/subscriptions","organizations_url":"https://api.github.com/users/phamquochoan/orgs","repos_url":"https://api.github.com/users/phamquochoan/repos","events_url":"https://api.github.com/users/phamquochoan/events{/privacy}","received_events_url":"https://api.github.com/users/phamquochoan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SnapKit/SnapKit/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/SnapKit/SnapKit/labels/waiting%20for%20release","name":"waiting for release","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-23T03:30:55Z","updated_at":"2016-09-27T06:40:42Z","closed_at":null,"body":"### New Issue Checklist\r\n\r\n🚫 If this template is not filled out your issue **will** be closed with no comment. 🚫\r\n\r\n* [x] I have looked at the [Documentation](http://snapkit.io/docs)\r\n* [x] I have read the [F.A.Q.](http://snapkit.io/faq)\r\n* [x] I have filled out this issue template.\r\n\r\n### Issue Info\r\n\r\n Info                    | Value                               |\r\n-------------------------|-------------------------------------|\r\n Platform                | iOS (Xcode 8, swift 3)\r\n Platform Version        | 8.4\r\n SnapKit Version         | 3.0.1\r\n Integration Method      |  carthage\r\n \r\n\r\n### Issue Description\r\n\r\nI've migrated my projects to Swift 3.0, they work fine on iOS 9.x and 10.x\r\nHowever, this problem only appears on iOS 8.x (reported on simulator and iOS device running iOS 8.4):\r\n\r\n```\r\n2016-09-23 10:23:47.828 SnapDemo[13609:131065] *** Assertion failure in -[SnapKit.LayoutConstraint setPriority:], /SourceCache/Foundation_Sim/Foundation-1144.17/Layout.subproj/NSLayoutConstraint.m:174\r\n2016-09-23 10:23:47.831 SnapDemo[13609:131065] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Mutating a priority from required to not on an installed constraint (or vice-versa) is not supported.  You passed priority 1000 and the existing priority was 1000.'\r\n*** First throw call stack:\r\n(\r\n\t0   CoreFoundation                      0x00a31746 __exceptionPreprocess + 182\r\n\t1   libobjc.A.dylib                     0x006baa97 objc_exception_throw + 44\r\n\t2   CoreFoundation                      0x00a315da +[NSException raise:format:arguments:] + 138\r\n\t3   Foundation                          0x00327720 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118\r\n\t4   Foundation                          0x002944ef -[NSLayoutConstraint setPriority:] + 397\r\n\t5   SnapKit                             0x001f8d88 _TFC7SnapKit10Constraint33updateConstantAndPriorityIfNeededfT_T_ + 1048\r\n\t6   SnapKit                             0x001f5b90 _TFC7SnapKit10ConstraintWP33_F1BDC77CAFF662929BB62E80B81AE0B78constantPS_24ConstraintConstantTarget_ + 32\r\n\t7   SnapKit                             0x001f5ce5 _TFC7SnapKit10ConstraintsP33_F1BDC77CAFF662929BB62E80B81AE0B78constantPS_24ConstraintConstantTarget_ + 229\r\n\t8   SnapKit                             0x001f822e _TFC7SnapKit10Constraint6updatefT6offsetPS_22ConstraintOffsetTarget__S0_ + 158\r\n\t9   SnapDemo                            0x000d7dc9 _TFFC8SnapDemo14ViewController11viewDidLoadFT_T_U_FT_T_ + 249\r\n\t10  SnapDemo                            0x000d7f68 _TTRXFo___XFdCb___ + 40\r\n\t11  libdispatch.dylib                   0x035a75ea _dispatch_call_block_and_release + 15\r\n\t12  libdispatch.dylib                   0x035c9bef _dispatch_client_callout + 14\r\n\t13  libdispatch.dylib                   0x035af6bb _dispatch_main_queue_callback_4CF + 993\r\n\t14  CoreFoundation                      0x0098a8ee __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14\r\n\t15  CoreFoundation                      0x009485f0 __CFRunLoopRun + 2256\r\n\t16  CoreFoundation                      0x00947a5b CFRunLoopRunSpecific + 443\r\n\t17  CoreFoundation                      0x0094788b CFRunLoopRunInMode + 123\r\n\t18  GraphicsServices                    0x044d52c9 GSEventRunModal + 192\r\n\t19  GraphicsServices                    0x044d5106 GSEventRun + 104\r\n\t20  UIKit                               0x00df00b6 UIApplicationMain + 1526\r\n\t21  SnapDemo                            0x000d9f01 main + 145\r\n\t22  libdyld.dylib                       0x035f4ac9 start + 1\r\n)\r\nlibc++abi.dylib: terminating with uncaught exception of type NSException\r\n```\r\n\r\n\r\nDemo code (straight from SnapKit 3.0.1 source code):\r\n\r\n```swift\r\nimport UIKit\r\nimport SnapKit\r\n\r\nclass ViewController: UIViewController {\r\n\r\n    var v1: UIView!\r\n    var v2: UIView!\r\n    \r\n    var c1: Constraint! = nil\r\n    var c2: Constraint! = nil\r\n    \r\n    var didSetupConstraints = false\r\n    \r\n    \r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        \r\n        v1 = UIView()\r\n        v1.backgroundColor = UIColor.red.withAlphaComponent(0.5)\r\n        \r\n        v2 = UIView()\r\n        v2.backgroundColor = UIColor.blue.withAlphaComponent(0.5)\r\n        \r\n        view.addSubview(v1)\r\n        view.addSubview(v2)\r\n        \r\n        view.setNeedsUpdateConstraints()\r\n   \r\n        DispatchQueue.main.asyncAfter(deadline: DispatchTime(uptimeNanoseconds: 1000)) { [unowned self] in\r\n            self.c1.update(offset: 15)\r\n            self.c2.update(offset: 20)\r\n        }\r\n        \r\n        \r\n        DispatchQueue.main.asyncAfter(deadline: DispatchTime(uptimeNanoseconds: 2000)) { [unowned self] in\r\n            self.c1.update(inset: 15)\r\n            self.c2.update(inset: 20)\r\n        }\r\n        \r\n    }\r\n    \r\n    override func updateViewConstraints() {\r\n        guard !didSetupConstraints else  { return }\r\n        \r\n        v1.snp.makeConstraints { (make) -> Void in\r\n            c1 = make.top.equalTo(v2).offset(50).constraint\r\n            c2 = make.bottom.equalTo(v2).offset(25).constraint\r\n            return\r\n        }\r\n        \r\n        didSetupConstraints = true\r\n    \r\n        super.updateViewConstraints()\r\n    }\r\n\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/SnapKit/SnapKit/issues/comments/249779421","html_url":"https://github.com/SnapKit/SnapKit/issues/332#issuecomment-249779421","issue_url":"https://api.github.com/repos/SnapKit/SnapKit/issues/332","id":249779421,"user":{"login":"phamquochoan","id":3321851,"avatar_url":"https://avatars.githubusercontent.com/u/3321851?v=3","gravatar_id":"","url":"https://api.github.com/users/phamquochoan","html_url":"https://github.com/phamquochoan","followers_url":"https://api.github.com/users/phamquochoan/followers","following_url":"https://api.github.com/users/phamquochoan/following{/other_user}","gists_url":"https://api.github.com/users/phamquochoan/gists{/gist_id}","starred_url":"https://api.github.com/users/phamquochoan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phamquochoan/subscriptions","organizations_url":"https://api.github.com/users/phamquochoan/orgs","repos_url":"https://api.github.com/users/phamquochoan/repos","events_url":"https://api.github.com/users/phamquochoan/events{/privacy}","received_events_url":"https://api.github.com/users/phamquochoan/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T06:40:42Z","updated_at":"2016-09-27T06:40:42Z","body":"@studioofthemonth I got no problem after switching to develop branch. It maybe a different error I guess."}}
{"actor":{"display_login":"phamquochoan"}}