Crash in UITextField

I’m calling SDL_UIKitRunApp to start my iPhone program due to some linker errors (I’m using Pascal) and everything works fine (SDL_Init is called without error after entering SDL_main) but when I call SDL_CreateWindow I get this crash deep in the call stack.

I know I don’t have much info for you but that’s the nature of using non-C languages with SDL and all the particularities of the compilers build system.

Do you happen to have any idea what could possibly be causing this? Any tips would be great.

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x00007fff2554864d in -[UIScrollView _adjustedContentOffsetForContentOffset:skipsAdjustmentIfScrolling:] ()
#1	0x00007fff25548f5d in -[UIScrollView _adjustContentOffsetIfNecessary] ()
#2	0x00007fff2551f4d7 in -[UIScrollView setFrame:] ()
#3	0x00007fff25588cb3 in UIViewCommonInitWithFrame ()
#4	0x00007fff25588672 in -[UIView initWithFrame:] ()
#5	0x00007fff2551b093 in -[UIScrollView initWithFrame:] ()
#6	0x00007fff25373471 in -[UIFieldEditor initWithTextField:] ()
#7	0x00007fff25392007 in -[UITextField _fieldEditor] ()
#8	0x00007fff25393d14 in -[UITextField _inputController] ()
#9	0x00007fff2538b5bc in -[UITextField setTextAlignment:] ()
#10	0x00007fff2538b742 in -[UITextField setDefaultTextAttributes:] ()
#11	0x00007fff2537d554 in __55-[UITextField _initWithFrame:textLayoutManagerEnabled:]_block_invoke ()
#12	0x00007fff25587486 in +[UIView _performSystemAppearanceModifications:] ()
#13	0x00007fff2537d3da in -[UITextField _initWithFrame:textLayoutManagerEnabled:] ()
#14	0x00000001094b87f9 in -[SDL_uikitviewcontroller initKeyboard] at /Users/ryanjoseph/Developer/SDL2-2.0.20/src/video/uikit/SDL_uikitviewcontroller.m:272
#15	0x00000001094b7f01 in -[SDL_uikitviewcontroller initWithSDLWindow:] at /Users/ryanjoseph/Developer/SDL2-2.0.20/src/video/uikit/SDL_uikitviewcontroller.m:95
#16	0x00000001094c7541 in SetupWindowData at /Users/ryanjoseph/Developer/SDL2-2.0.20/src/video/uikit/SDL_uikitwindow.m:145
#17	0x00000001094c7152 in UIKit_CreateWindow at /Users/ryanjoseph/Developer/SDL2-2.0.20/src/video/uikit/SDL_uikitwindow.m:221
#18	0x000000010952fff0 in SDL_CreateWindow at /Users/ryanjoseph/Developer/SDL2-2.0.20/src/video/SDL_video.c:1718
#19	0x0000000108c1ee6d in PASCALMAIN ()
#20	0x0000000108c4194c in FPC_SysEntry ()
#21	0x0000000108c1ed92 in FPC_SYSTEMMAIN ()

If for any reason at all it helps to see the Pascal program.

{$mode objfpc}
{$pascalmainname SDL_main}

{$linkframework SDL2}

program IPhoneSDL;
uses
  SDL;

function SDL_main(argc: integer; argv: pchar): integer; cdecl; external;
function SDL_UIKitRunApp(argc: integer; argv: pchar; mainFunction: pointer): integer; cdecl; external;

function main(argc: integer; argv: pchar): integer; cdecl; public;
begin
  result := SDL_UIKitRunApp(argc, argv, @SDL_main);
end;

var
  event: TSDL_Event;
  window: PSDL_Window;
  context: PSDL_GLContext;
begin
  if SDL_Init(SDL_INIT_VIDEO) < 0 then
    halt(1);

  window := SDL_CreateWindow('My Window', SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, SDL_WINDOW_SHOWN + SDL_WINDOW_OPENGL);
  if window <> nil then
    begin
      context := SDL_GL_CreateContext(window);
      SDL_GL_MakeCurrent(window, context);
    end
  else
    halt(1);

  SDL_DestroyWindow(window);
  SDL_Quit;
end.