Xcode 10 Archive Error: "Argument passed to call that takes no arguments"

Hello:


I am seeing the following error under Xcode 10.0. The error is noted with line 2 of the enclosed code segment. It has me stumped.


  • It was previously working under XCode 9.4, meaning I was able to create the archive.
  • I can build it without issue, but when I try to "Archive", it does not build, and results in the "Swift Compile Error": "Argument passed to call that takes no arguments"
  • I can "Build" and run in the iOS 12 Simulator and on an actual iOS 12 device.
  • It fails when I attempt "Archive" in Xcode. I cannot create the archive via Fastlane either. Fastlane results in the same error.
  • This code is Swift 4, not Swift 4.2.


let textFieldRect = CGRect(x: 10.0, y: 10.0, width: 100.0, height: 100.0)
let textField1 = UITextField(frame: textFieldRect)


Thanks.

Accepted Reply

Quinn -


Okay, I am able to create an archive. I had two targets that used just about all the same *.swift files (79 total). One target worked, the offending target did not. So I reordered the files one by one in the target that did not archive to match the target that did Archive. Eventually, it was able to create the archive.


Thanks.

Replies

I created a tiny test project with this code and it archives just fine, so I strongly suspect that there are other issues in play here. To start, I recommend that you create your own small test project to verify that it will archive with that code. If not, there’s some problem with your wider environment.

If, however, your tiny test project works, then there’s something about your main project that’s causing the issue. I have some thoughts on how ot debug that, but let’s check first things first.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Quinn -


Thank you for your response.


  • I also created a test project, included all the imports, included the complete file that I am having the issue with. I was able to create an Archive without issue
  • I also removed the file from the project, then added it back into the project. Still had the issue.
  • I removed the DerivedData directory and also cleaned the project and folder. Still had the issue.
  • I restarted Xcode. Still had the issue.
  • Within the file itself, I removed the UITextField, and replaced that code segment with a UITextView to see if it was an ordering issue, and it did not fail. When I put it back in, it fails.



Thanks.

Quinn -


Okay, I am able to create an archive. I had two targets that used just about all the same *.swift files (79 total). One target worked, the offending target did not. So I reordered the files one by one in the target that did not archive to match the target that did Archive. Eventually, it was able to create the archive.


Thanks.

I also encountered this problem, can compile successfully, but at the same time will report the error.