sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.97k stars 117 forks source link

Xcode 13 archive error #81

Closed automactic closed 2 years ago

automactic commented 2 years ago

Hey, thanks for creating and maintaining this awesome package. Using the GM version of Xcode 13 (13A233), I can compile and run my app against the iOS 15 SDK just fine, but encountering errors when archiving the app. See screenshot below for detail.

It seems rather strange... Maybe we need to do canImport(Combine) && canImport(SwiftUI) at the top of SwiftUI.swift? I got no idea

Screen Shot 2021-09-14 at 10 39 42 PM
quantamrhino commented 2 years ago

Same problem here :-(

sindresorhus commented 2 years ago

I just tried archiving with the latest Xcode 13 RC on multiple projects and it works fine for me. Try cleaning your build folder and resetting the package cache ("File" => "Packages").

Are you using the latest version of Defaults?

quantamrhino commented 2 years ago

version 4 of defaults- just realized there's a steep migration step to go to 5 (i'll do that soon - need testing time). this was on a clean build. i'll try reseting the cache and report back.

quantamrhino commented 2 years ago

No luck. did a package cache reset, cleaned build folder and archived again. Same errors. :-(

xiao99xiao commented 2 years ago

This is caused by a known issue in Xcode 13 throughout Beta and RC. You can read more details about it in its release notes here(Search for 74120874)

It only happens in building for armv7 devices or archiving, which may possibly explain why @sindresorhus doesn't meet the issue while others did.

The suggested workaround is lifting the deploy target up to iOS_12.

RoyRao2333 commented 2 years ago

My deployment target is iOS13 but @xiao99xiao is right.

If your built device is something like Any iOS Device (arm64), you'll meet these bugs for no reason. The solution for now is to select a simulator other than an arm64 device in build-time. Or, you can just plug your iPhone in and debug on your own devices.

Hope this will help anybody.

quantamrhino commented 2 years ago

For me its the archive. my target ios is 14. i can't upload a build to testflight because of this.

automactic commented 2 years ago

Yeah the problem is not build, it is archiving. Even if I tell Xcode to explicitly exclude armv7, I am still having this issue. (my deployment target is iOS 13)

@sindresorhus Does any project you tested with use swiftui?

Screen Shot 2021-09-15 at 7 42 53 AM
automactic commented 2 years ago

The suggested workaround is lifting the deploy target up to iOS_12.

Ohhh, upon re-reading the release note, I realized the dependency needs to (temporarily) raise the deploy target to v12. I though my app needs to make this change.

I forked this library, made that single change and was able to archive my app.

pwightman commented 2 years ago

I'm also having this error, and the fix does appear to be to update Defaults' deploy target to v12 in Package.swift. I'd like to not fork this, and would also prefer not to have to upgrade to v5 (still on v4) just to get this fix...anyone have a workaround? May just need to create a fork in the meantime.

image

igoriols commented 2 years ago

The suggested workaround is lifting the deploy target up to iOS_12.

Ohhh, upon re-reading the release note, I realized the dependency needs to (temporarily) raise the deploy target to v12. I though my app needs to make this change.

I forked this library, made that single change and was able to archive my app.

I tried to do the same thing, but I'm not able to import the dependency from my fork using Swift Package Manager. It always targeting the original repo. Hi, @automactic how did you import the library from your fork? Can you help me?

pwightman commented 2 years ago

FWIW, I forked and branched from the most recent 4.X.X commit, change to v12 and it did work.

pwightman commented 2 years ago

I had to remove the original Defaults package, and then added it via Xcode 13's package thing, pasting my URL into the textbox in the top-right corner and adding the package that showed up. I then specified the branch name I had made.

JustinFincher commented 2 years ago

The suggested workaround is lifting the deploy target up to iOS_12.

Ohhh, upon re-reading the release note, I realized the dependency needs to (temporarily) raise the deploy target to v12. I though my app needs to make this change. I forked this library, made that single change and was able to archive my app.

I tried to do the same thing, but I'm not able to import the dependency from my fork using Swift Package Manager. It always targeting the original repo. Hi, @automactic how did you import the library from your fork? Can you help me?

@igoriols I was able to resolve the issue by removing the previous Default repo link from "Recently Used" in the first place and then paste the one from @automactic. It should be pointing to the new one after that

image

automactic commented 2 years ago

@igoriols Hey sorry I forgot to reply to your question, @JustinFincher got the right answer

sindresorhus commented 2 years ago

This is fixed in Defaults v6: https://github.com/sindresorhus/Defaults/releases/tag/v6.0.0

I have been planning to drop some older platform versions, so this seemed like a good opportunity to do so as it also fixes this issue.