My app builds fine, but now I'm attempting to build for Archive, and I'm getting this error:
Undefined symbols for architecture arm64:
"type metadata for (extension in TwIM):__ObjC.NSData.ImageType", referenced from:
static TwIM.ImageCache.imagePath (imageURL : __ObjC.NSURL, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> Swift.String? in ImageCache.o
function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of static TwIM.ImageCache.imagePath (identifier : Swift.String, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> Swift.String? in ImageCache.o
function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of static TwIM.ImageCache.imageData (identifier : Swift.String, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> __ObjC.NSData? in ImageCache.o
function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of static TwIM.ImageCache.image (identifier : Swift.String, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> Swift.AnyObject? in ImageCache.o
function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed and Exploded> of static TwIM.ImageCache.saveImage (imageData : __ObjC.NSData, identifier : Swift.String, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> Swift.Bool in ImageCache.o
function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of static TwIM.ImageCache.removeImage (identifier : Swift.String, imageType : (extension in TwIM):__ObjC.NSData.ImageType?) -> () in ImageCache.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What it's referring to is an extension I have on NSData, which includes an enum:
extension NSData {
enum ImageType: String {
case jpg = "jpg"
case png = "png"
case gif = "gif"
}
}
I don't know why this would be causing an issue. I've cleaned, and cleared derived data as some people have suggested.
Which Xcode and which Swift version do you use?
I first discovered this error message with Xcode 8 and Swift 3 beta 6. I had a look on what I imported but it was only Cocoa for all files. There were several errors of this kind, almost all belonging to a function, which was very large. The error only happens, if Global-Module-Optimization is selected, regardless if running or archiving.
So I divided this function in 6 smaller parts to look, which one was causing the problem. After making the function smaller, only two errors of this kind stayed. So I think it is a linker/optimizer-Problem in my case, because the code is the same, only divided in several small functions.
Please try to select Single-File-Optimization for Release and try to Archive. Does the error come again or are you successfull?
I guess, this will be not a problem in the final release.
I had this problem too. And I solved this with following operations: 1. Go to build setting. 2. Search for enable testablility. 2. Set No for Debug.
Try getting rid of the enum. That's what fixed it for me. Maybe there's a problem with enums in extensions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.