iOS Question [SOLVED] How to know if it's not needed to initialize?

Discussion in 'iOS Questions' started by Sandman, Feb 7, 2018.

  1. Sandman

    Sandman Well-Known Member Licensed User

    I have this code, which I believe is correct, even though the variable isn't initialized:

    Code:
    ' Check if we have access to the camera   
        Dim llc As LLCamera

        
    If llc.AuthorizationDenied Then
            
    Log("Fail")
        
    End If
    The linter in the IDE gives me the error "Variable 'llc' was not initialized. (warning #11)".

    I know that I can filter away the error by doing one of these:
    Code:
    Dim llc As LLCamera 'ignore
    #IgnoreWarnings: 11
    But what I'm really wondering is if there is a way to know when an initialize is not needed? I can't find any mention in the documentation about this, and haven't been able to find anything in the forum either. (As a reference, here's a thread with code that clearly shows that AuthorizationDenied is tested before it's initialized.)

    Bottom line is that I want to understand how this works so that I don't filter away real errors when I add the 'ignore
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It should have been documented in this property that it can be used without initializing the object (assuming that there is such a use case). There is no other way to know it.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice