Xcode 错误“函数声明的参数列表中应为 '('”

Posted

技术标签:

【中文标题】Xcode 错误“函数声明的参数列表中应为 \'(\'”【英文标题】:Xcode error "Expected '(' in argument list of function declaration"Xcode 错误“函数声明的参数列表中应为 '('” 【发布时间】:2020-03-08 19:33:30 【问题描述】:

func filepriavte; func setupGoogleButtons() 处收到错误提示

函数声明的参数列表中应为“(”

import UIKit

import Firebase

import GoogleSignIn

class ViewController: UIViewController, GIDSignInUIDelegate 
    
    override func viewDidLoad() 
        super.viewDidLoad()

        setupGoogleButtons()
    
    
    ****func filepriavte; func setupGoogleButtons()** **
        // Add Google Login Button
        
        let googleButton = GIDSignInButton()
        googleButton.frame = CGReact(x: 60, y: 500, width: view.frame.width - 115,
                                     geight: 50)
        view.addSubview(googleButton)
        
        GIDSignIn.sharedInstance().uiDelegate = self
    
    
    override func didReceiveMemoryWarning() 
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    


【问题讨论】:

****func filepriavte; func setupGoogleButtons()** ** 应该是fileprivate func setupGoogleButtons() 所有的星号是怎么回事? 【参考方案1】:

整个Controller应该是这样的

import UIKit

import Firebase

import GoogleSignIn

class ViewController: UIViewController, GIDSignInUIDelegate 

    override func viewDidLoad() 
        super.viewDidLoad()

        setupGoogleButtons()
    

    priavte func setupGoogleButtons()  // Use private instead of fileprivate
        // Add Google Login Button

        let googleButton = GIDSignInButton()
        googleButton.frame = CGReact(x: 60, y: 500, width: view.frame.width - 115,
                                     geight: 50)
        view.addSubview(googleButton)

        GIDSignIn.sharedInstance().uiDelegate = self
    

    override func didReceiveMemoryWarning() 
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    


希望这会奏效。

【讨论】:

以上是关于Xcode 错误“函数声明的参数列表中应为 '('”的主要内容,如果未能解决你的问题,请参考以下文章

Xcode 项目更新到 Xcode 到 6.3 后显示错误

Xcode 存档验证错误 - Xcode 9 和 Swift 4

FBSDK 的 Xcode 12 错误

Xcode 7.1 错误 UIAccessibility 错误

Xcode 5.0.2 错误:无法在 Xcode 中启动问题 [关闭]

Xcode 编译因内部错误而失败