iOS Question Class Initialize2?

Discussion in 'iOS Questions' started by qsrtech, May 19, 2015.

  1. qsrtech

    qsrtech Active Member Licensed User

    I noticed a lot of objects have an Initialize2 and even 3 or 4, but I can't seem to make this work within my classes. I tried calling the main Initialize, kinda like inheritance but it doesn't seem to work. I realize we can add parameters to the original Initialize but there is still no optional parameters feature.

    How does one go about doing this properly?

    Thanks.
     
  2. klaus

    klaus Expert Licensed User

    You should explain what exactly you want to do !
    Without knowing this it's impossible to give you a concrete advice.
     
  3. qsrtech

    qsrtech Active Member Licensed User

    I have to apologize. At first I was getting "Null" errors when trying to implement an Initialize2 method but everything seems to be working now. I don't know if it has something to do with forcing a complete recompile. Nevertheless it is working good so far.

    EDIT!
    Well unfortunately I have to take the apology back. I try to "Build release app" and compiler complains about a missing "," see attached [but runs fine in debug] Tried project clean. Funny thing is if I add a dummy parameter i.e. Initialize(Name,TargetModule,"") it complies fine but when app is run on device it crashes.
     

    Attached Files:

    Last edited: May 20, 2015
  4. klaus

    klaus Expert Licensed User

    Sorry, this is beyond my knowledge.
    I tested it in a small project and I get the same error.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You must first call the Initialize method. This is true in B4i, B4A and B4J.
     
  6. qsrtech

    qsrtech Active Member Licensed User

    So there's not much point in having an initialize2? Still doesn't explain why it compiles/works in debug mode but not release.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Not really. Only the Initialize method is a "special" method. It will also fail in debug mode in some cases (depending on the state of the installed app compared to the current code).
     
  8. qsrtech

    qsrtech Active Member Licensed User

    Well i don't think it's fair (or consistent) that libraries can have them but we can't.
     
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