Saturday, September 24, 2022
HomeiOS DevelopmentiOS Swift - Surprising non-void return worth in void operate and extra...

iOS Swift – Surprising non-void return worth in void operate and extra errors

I am attempting to easily name this operate:

func sendToServer(personId: String) async throws {


From this operate:

func checkStatus(){
    if(GIDSignIn.sharedInstance.currentUser != nil){
        let consumer = GIDSignIn.sharedInstance.currentUser
        guard let consumer = consumer else { return }
        let personId = consumer.userID
        let displayName = consumer.profile?.title
        let personGivenName = consumer.profile?.givenName
        let personFamilyName = consumer.profile?.familyName
        let personPhoto = consumer.profile?.imageURL(withDimension: 200)?.absoluteString

        let picture = ""
        if(personPhoto != nil){
            let picture = personPhoto

        attempt await sendToServer(personId: personId)

        // error

and I do not know the place even to start out as a result of after I repair one downside then others seem so I can not open new questions for them individually as a result of I do not know if the answer which brought about these errors is even right

The primary error is:

Surprising non-void return worth in void operate


let personId = consumer.userID

and I can not discover a human comprehensible resolution for this nonsense

subsequent error:

'async' name in a operate that doesn't help concurrency

the “resolution” I’ve discovered was to make use of it inside activity{} and the error disappeared however after I opened the challenge on the subsequent day this error appeared once more.

The following is:

Worth of optionally available sort 'String?' should be unwrapped to a worth of sort 'String'


personId: personId

and all of the fixes which xcode presents are inflicting all sort of different issues



Please enter your comment!
Please enter your name here

Most Popular