PhoneCallTask​​失败

时间:2013-07-10 08:05:22

标签: windows-phone-7 windows-phone-8 windows-phone windows-phone-7.1

这是一项非常简单的任务,但不知怎的,它失败了......

private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
    {
        if (WasSwipe != true)
        {
            //JUST TO CHECK THAT CODE GETS HERE - RUNS PERFECT
            MessageBox.Show("");

            //FUNCTION
            var phoneCallTask = new PhoneCallTask
            {
                DisplayName = "Kunal Chowdhury",
                PhoneNumber = "0208795446322"
            };
            phoneCallTask.Show();
            //FAILS HERE, AFTER SHOW
        }
        else
        {
            WasSwipe = false;
        }
    }

当我想显示任务时,它失败了:

  

消息:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))

     

来源: Microsoft.Phone

     

Stack-trace: at Microsoft.Phone.Tasks.PhoneCallTask​​.NativeMethods.PhoneInitiateOutgoingPhoneCall_External(String   pDialString,String pDisplayName)

     

at Microsoft.Phone.Tasks.PhoneCallTask​​.PhoneDial(Object   phoneCallTask​​)

     

在   System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(对象   状态)

     

在System.Threading.ExecutionContext.RunInternal(ExecutionContext   executionContext,ContextCallback回调,对象状态,布尔值   preserveSyncCtx)

     

在System.Threading.ExecutionContext.Run(ExecutionContext   executionContext,ContextCallback回调,对象状态,布尔值   preserveSyncCtx)

     

在   System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

     

在System.Threading.ThreadPoolWorkQueue.Dispatch()

     

在System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

另外:

电子邮件任务有效:

 EmailComposeTask emailComposeTask = new EmailComposeTask();

            emailComposeTask.Subject = "message subject";
            emailComposeTask.Body = "message body";
            emailComposeTask.To = "recipient@example.com";
            emailComposeTask.Cc = "cc@example.com";
            emailComposeTask.Bcc = "bcc@example.com";

            emailComposeTask.Show();

1 个答案:

答案 0 :(得分:6)

您可能未在应用manifest file中指定以下权限:

ID_CAP_PHONEDIALER