iOS Question [SOLVED] Extract Team ID

JackKirk

Well-Known Member
Licensed User
Longtime User
I'm trying to extract an apps Team ID using code based on the answer here:

http://stackoverflow.com/questions/...to-get-team-id-of-my-ios-app-programmatically

My effort is:
B4X:
#Region  Project Attributes
    #ApplicationLabel: Bug
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 7
    #PlistExtra:<key>AppIdentifierPrefix</key><string>$(AppIdentifierPrefix)</string>

#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page

End Sub

Private Sub Application_Start (Nav As NavigationController)
    Dim rl As ReleaseLogger
    rl.Initialize("192.168.1.6", 54323)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    Log(appIdentifierPrefix)
End Sub

Private Sub appIdentifierPrefix As String
    Dim no As NativeObject
    Return no.Initialize("NSBundle") _
        .RunMethod("mainBundle", Null).RunMethod("objectForInfoDictionaryKey:", Array("@""AppIdentifierPrefix""")).AsString
End Sub
But this blows up with B4ilogger saying:
Object was not initialized (NSObject)
Stack Trace: (
CoreFoundation <redacted> + 152
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
Bug -[B4IObjectWrapper object] + 200
Bug -[B4INativeObject AsString] + 70
Bug -[b4i_main _appidentifierprefix] + 404
Bug -[b4i_main _page1_resize::] + 122
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 300
Bug +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
Bug -[B4I raiseEvent:event:params:] + 634
Bug +[B4IObjectWrapper raiseEvent:::] + 220
Bug __30-[B4IPanelView layoutSubviews]_block_invoke + 1040
libdispatch.dylib <redacted> + 10
libdispatch.dylib <redacted> + 22
libdispatch.dylib _dispatch_main_queue_callback_4CF + 902
CoreFoundation <redacted> + 8
CoreFoundation <redacted> + 848
CoreFoundation CFRunLoopRunSpecific + 470
CoreFoundation CFRunLoopRunInMode + 104
GraphicsServices GSEventRunModal + 80
UIKit UIApplicationMain + 150
Bug main + 106
libdyld.dylib <redacted> + 2
)

Any help appreciated...
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Thanks Erel, works a treat.
 
Upvote 0
Top