chirag04 / react-native-mail

A wrapper on top of MFMailComposeViewController from iOS and Mail Intent on android
MIT License
445 stars 249 forks source link

Unable to open MailCompose View in iOS #169

Open vivek-gunasekaran opened 3 years ago

vivek-gunasekaran commented 3 years ago

I recently upgraded to RN 60.2 and react-native-mail 6.0.0 and encountered this issue. When the Mailer.mail({ }) API is triggered, it doesn't do anything on the iOS device. Android works as expected and iOS simulator fails with the expected error message. iOS version is 13.5

When I inspected the console logs, I see that the request to open the mail compose view is suspended immediately upon request.

        SpringBoard [FBSystemService][0xdc97] Received request to open "com.apple.MailCompositionService" from myApp:1112.
    SpringBoard [FBSystemService][0xdc97] Trusting whitelisted background activation from myApp:1112.
    SpringBoard Received trusted open application request for "com.apple.MailCompositionService" from <FBApplicationProcess: 0x100398c30; application<myApp>:1112>.
    SpringBoard Executing request: <SBMainWorkspaceTransitionRequest: 0x283db1300; eventLabel: OpenApplication(sceneID:com.apple.MailCompositionService-default)ForRequester(myApp.1112); display: Main; source: FBSystemService>
    SpringBoard Executing suspended-activation immediately: OpenApplication(sceneID:com.apple.MailCompositionService-default)ForRequester(myApp.1112)
    myApp   Creating service facility connection with <BSServiceConnectionEndpoint: 0x2835b33c0; target: com.apple.frontboard.systemappservices; service: com.apple.frontboard.system-service>
    myApp   [FBSSystemService][0xdc97] Sending request to open "com.apple.MailCompositionService"
    myApp   [FBSSystemAppProxy:0x280b61c00] Service facility connection invalidated
    SpringBoard [FBSystemService][0xdc97] Request complete; no error reported.
    SpringBoard [sceneID:com.apple.MailCompositionService-default] Sending scene action [SceneLifecycleEventOnly][0xfd02] through WorkspaceServer: 0x2807dfac0
    SpringBoard [sceneID:com.apple.MailCompositionService-default] Scene activity state did change: BackgroundActive.
    runningboardd   Acquiring assertion targeting application<com.apple.MailCompositionService> from originator [application<myApp>:1112] with description <RBSAssertionDescriptor; com.apple.viewservice.session; ID: 28-1112-3915; target: application<com.apple.MailCompositionService>> attributes = {
    <RBSLegacyAttribute: 0x1058da730; requestedReason: ViewService; reason: ViewService; flags: AllowIdleSleep | PreventTaskSuspend | PreventTaskThrottleDown | WantsForegroundResourcePriority>;
    <RBSAcquisitionCompletionAttribute: 0x1058aba30; policy: 0>;
}
    runningboardd   Assertion 28-1112-3915 (target:application<com.apple.MailCompositionService>) will be created as active
    runningboardd   Acquiring assertion targeting application<com.apple.MailCompositionService> from originator [daemon<com.apple.SpringBoard>:56] with description <RBSAssertionDescriptor; "FBScene (BackgroundActive) <sceneID:com.apple.MailCompositionService-default>"; ID: 28-56-3916; target: 379> attributes = {
    <RBSRunningReasonAttribute: 0x1047dd200; runningReason: 10001>;
    <RBSDefineRelativeStartTimeGrant: 0x1047de590>;
    <RBSGPUAccessGrant: 0x104739e90>;
    <RBSCPUAccessGrant: 0x1047ffec0; role: NonUserInteractive>;
    <RBSJetsamPriorityGrant: 0x1047e5ba0; priority: Background>;
    <RBSDurationAttribute: 0x1047a8e40; invalidationDuration: 20.00; warningDuration: 0.00; startPolicy: Fixed; endPolicy: Invalidate>;
    <RBSResistTerminationGrant: 0x1047f94f0; terminationResistance: NonInteractive>;
}
    runningboardd   Assertion 28-56-3916 (target:application<com.apple.MailCompositionService>) will be created as active
    myApp   [FBSSystemService][0xdc97] Request successful: <BSProcessHandle: 0x28354a400; MailComposition:379; valid: YES>

Any idea what might be happening? I wanted to reach out to the community to see if someone else is encountering this issue or this is a user error on my end.

aswin9339 commented 3 years ago

There is no email client in ios emulator. Please try it in real device

vivek-gunasekaran commented 3 years ago

This was tested on an iPhone, the logs snippet is for the same.

ghost commented 3 years ago

@vivek-gunasekaran This library using MF Mail composer. So for using mail in iPhone device you have to configure mail app in your device then only it will work. Please check if mail app is configured or not as below https://support.apple.com/en-in/HT201320