NullReferenceException when use Office 365 API in Xamarin.IOS

痴心易碎 提交于 2019-12-12 17:22:34

问题


First I got this issue: Using Office 365 API in Xamarin.Android

Now testing the same in Xamarin IOS I got another :(

{System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.Office365.OAuth.Authenticator.GetRefreshToken (System.String resource) [0x00000] in <filename unknown>:0 
  at Microsoft.Office365.OAuth.Authenticator+<GetAuthenticationResult>d__c.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62 
  at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.OAuth.AuthenticationInfo].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59 
  at Microsoft.Office365.OAuth.Authenticator+<AuthenticateAsync>d__6.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62 
  at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.Office365.OAuth.AuthenticationInfo].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59 
  at Office365InXamarinApps.ViewModel.ContactsViewModel+<EnsureClientCreated>d__9.MoveNext () [0x00046] in c:\DevApps\GitHub\Office365InXamarinApps\scr\Office365InXamarinApps\Office365InXamarinApps\ViewModel\ContactsViewModel.cs:76 }

The code is here: https://github.com/saramgsilva/Office365InXamarinApp


回答1:


The Office 365 API Preview has issues and I cannot use it, for this reason I created another demo using Office 365 REST API.

https://github.com/saramgsilva/Office365RESTAPISample




回答2:


You may want to check out this blog post (see link in Xamarin Forum) -Xamarin developer was able to get it working in Android

http://forums.xamarin.com/discussion/21367/put-some-office-365-in-your-apps



来源:https://stackoverflow.com/questions/24541318/nullreferenceexception-when-use-office-365-api-in-xamarin-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!