iOS Question PackageManager

Discussion in 'iOS Questions' started by Filippo, Nov 17, 2014.

  1. Filippo

    Filippo Expert Licensed User

    Hi,

    I asked this question yesterday in the wrong forum, I hope I am now in the correct forum.;)

    How can I convert this B4a functions in B4i?
    Thank you.
    Code:
    Sub getVersion As String
        
    Dim pm As PackageManager
        
    Return pm.GetVersionName(GetPackageName)
    End Sub

    Sub GetVersionCode As Int
        
    Dim pm As PackageManager
        
    Return pm.GetVersionCode(GetPackageName)
    End Sub

    Sub GetApplicationLabel As String
        
    Dim pm As PackageManager
        
    Return pm.GetApplicationLabel(GetPackageName)
    End Sub

    Sub GetPackageName As String
       
    Dim r As Reflector
       
    Return r.GetStaticField("anywheresoftware.b4a.BA""packageName")
    End Sub
     
    MarcoRome likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Sub GetAppName As String
       
    Dim no As NativeObject
       no = no.Initialize(
    "NSBundle").RunMethod("mainBundle"Null)
       
    Dim name As Object = no.RunMethod("objectForInfoDictionaryKey:"Array("CFBundleDisplayName"))
       
    Return name
    End Sub

    Sub GetVersion As String
       
    Dim no As NativeObject
       no = no.Initialize(
    "NSBundle").RunMethod("mainBundle"Null)
       
    Dim name As Object = no.RunMethod("objectForInfoDictionaryKey:"Array("CFBundleShortVersionString"))
       
    Return name
    End Sub
     
    MarcoRome and chardenal like this.
  3. Filippo

    Filippo Expert Licensed User

    Thank you
    :)
     
  4. Andris

    Andris Active Member Licensed User

    In trying to figure out how Erel comes up with this code so quickly, I found this page on the Apple Developer site. It was helpful to me and probably to many others:

    https://developer.apple.com/library....html#//apple_ref/doc/uid/10000123i-CH104-SW1
     
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