iOS Question mail problem

mrossen

Active Member
Licensed User
Longtime User
Hi.

I have a iPhone 5 with ios 10.3.3 that run this code perfect

B4X:
Dim mailc As MailComposer
    
    mailc.Initialize("mailc")
    mailc.SetToRecipients(Array("[email protected]"))

I also have a iPad with ios 12.1.1 that make this error when run the code

Any one has a suggestion why there is a difference here ?

B4X:
Error occurred on line: 650 (Main)
Object was not initialized (MFMailComposeViewController)
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  Find Cruise          -[B4IObjectWrapper object] + 152
  Find Cruise          -[B4IMailComposer SetToRecipients:] + 56
  Find Cruise          -[b4i_main _sendemail] + 872
  Find Cruise          -[b4i_main _ashinfo_click:] + 2456
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  Find Cruise          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
 Find Cruise          -[B4IShell runMethod:] + 448
 Find Cruise          -[B4IShell raiseEventImpl:method:args::] + 2164
 Find Cruise          -[B4IShellBI raiseEvent:event:params:] + 1372
 Find Cruise          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
 libdispatch.dylib    <redacted> + 24
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 1068
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 1964
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 100
 UIKitCore            UIApplicationMain + 212
 Find Cruise          main + 124
 libdyld.dylib        <redacted> + 4
)
 

mrossen

Active Member
Licensed User
Longtime User
Thank for the hint Erel, the sample code was not working.

The problem was that it is a new iPad where I not have setup the mail account :(

This line
B4X:
mailButton.Enabled = mailc.CanSendMail
got me on track :)

Mogens
 
Upvote 0
Top