PromiseKit: Problem with Archive with Xcode Version 7.3.1 (7D1014)
I am having issues with creating an archive when using PromiseKit with the newest Xcode. When trying to run an archive task I get a following error:
1. While emitting IR SIL function @_TZFE10PromiseKitCSo20NSNotificationCenter4oncefSSCS_19NotificationPromise for 'once' at /Users/mpigulski/Development/PromiseKitArchiveTest/Pods/PromiseKit/Categories/Foundation/NSNotificationCenter+Promise.swift:22:12 Segmentation fault: 11
I have attached a test project that allows to reproduce this: PromiseKitArchiveTest.zip
So to reproduce use Xcode Version 7.3.1 (7D1014):
- open the project using PromiseKitArchiveTest.xcworkspace
- go for Product -> Archive
Archive will fail. Help.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 64
- Comments: 46 (15 by maintainers)
Commits related to this issue
- Only use CorePromise to work around archiving issue https://github.com/mxcl/PromiseKit/issues/415 — committed to jakecraige/Inventry by jakecraige 8 years ago
- Only use CorePromise to work around archiving issue https://github.com/mxcl/PromiseKit/issues/415 — committed to jakecraige/Inventry by jakecraige 8 years ago
- Fix -O compilation in CLLocationManager+Promise Update fix in NSNotificationCenter+Promise to match Fixes #415 — committed to mxcl/PromiseKit by nathanhosselton 8 years ago
- update promise kit version to fix release problem https://github.com/mxcl/PromiseKit/issues/415 — committed to Scala-Dev/exp-ios-sdk by deleted user 8 years ago
- Fix NSNotificationCenter+Promise -O compilation Fixes #415 — committed to ScottPetit/PromiseKit by nathanhosselton 8 years ago
- Fix -O compilation in CLLocationManager+Promise Update fix in NSNotificationCenter+Promise to match Fixes #415 — committed to ScottPetit/PromiseKit by nathanhosselton 8 years ago
- adding a fix for https://github.com/mxcl/PromiseKit/issues/415 — committed to spotby/swagger-codegen by keenerthanyou 8 years ago
If you’re using Cocoapods, and not using anything in the subspec
PromiseKit/Foundation, a less hacky solution (not deleting files, changing repo etc.) is to split up the pods in your Podfile:I need the subspec
PromiseKit/Foundation. @MikeThomas1 's solution is working for me. But I am using Cocoapods and do not want to adjusting the pods project setting manually. So I just add this script to my podfile and it works fine.Having the same issue after upgrading to 7.3.1 - my project can build correctly but will not archive.
UPDATE:
NSNotificationCenter+Promise/AnyPromisefiles are removed on this branch.Easy fix for everybody: https://github.com/rad3ks/PromiseKit/tree/bug/415
Use in Podfile:
I wonder do we really need
?
Unfortunately I haven’t had extensive time to research this today, though I am giving it as much time as I can. More than likely though this is simply a swift bug. And although there may be a way we can work around it in our code, it might be simpler to just revert to the prior version of Xcode for the time being or, if you’re not using it, remove the NSNotificationCenter+Promise.swift file. In the meantime I will continue looking for a solution.
@hiromi2424 My code is here: https://gist.github.com/mnespor/be0d60bfefc04e54608b3cf67cbf0c43. To be clear, this is an exploration of the problem, not a fix—it breaks anything that uses the NSNotificationCenter extension.
Another work around is to simply remove NSNotificationCenter+Promise.swift from the PromiseKit target. There is no need to edit the file itself or remove the file at all. Just uncheck it’s target membership status.
Assuming you don’t need that category, here’s a
post_installstep for yourPodfilethat doesn’t require switching to a fork:Sorry if there’s a more standard way than dropping to bash, I’m not an expert in CocoaPods internals or Ruby for that matter.
yes I just test it and it works thanks!
It doesn’t make a lot of sense to have it IMHO. Notifications are inherently multi-fire things but Promises aren’t.
I wish I hadn’t added it considering this bug. But sadly we can’t remove it without breaking API compat. OTOH Swift makes keeping long-term major semantic versions near-impossible (considering bugs and regular syntax changes) so maybe we should just drop it and bump to 4.
NOTE THIS MEANS A PREMATURE BUMP TO PMK4
The problem is also with CLLocationManager+Promise.swift
Another temporary fix if you dont use the particular class
NSNotificationCenter+Promise.swift, I commented it in a fork : https://github.com/philippeauriach/PromiseKit/tree/fix-archive-xcode-7 You can use it with cocoapod :pod 'PromiseKit', :git => 'https://github.com/philippeauriach/PromiseKit.git', :commit => '266cfeb5073277b757efc4a37aa049efc96c596f'Alright, I think we’re good now. 3.2.1 has the fix and is live on the Cocoapods trunk. If you updated to 3.2.1 yesterday you may need to
pod cache clean PromiseKitandpod installagain.Again, apologies to all and thanks for bearing with us.
Seems like a new bug in Swift’s type inference? Changing
public class NotificationPromise: Promise<[NSObject: AnyObject]>topublic class NotificationPromise<T>: Promise<T>prevents the segmentation faultLooking at https://bugs.swift.org/browse/SR-1427, this was first reported 8 days ago. I suspect that reverting to Xcode 7.3 for now will fix.