question

Muharremcetin-9637 avatar image
0 Votes"
Muharremcetin-9637 asked BobJohnson-6874 edited

Data sharing problem between main app and Call Directory Extension

Hello
There is a Contact list in the main IOS project, I converted this list to text type and saved it with NSUserDefault with SetStringForKey method. However, I cannot access this data from CallDirectoryHandler. What am I missing?

This is AppDelegate :

string testText = "18775555555-Morten Nikolajsen,18885555555-Muharrem Cetin";
var defaultsTest = new NSUserDefaults("group.com.MyAppName", NSUserDefaultsType.SuiteName);
defaultsTest.SetString(testText, "CompanyContacts");
defaultsTest.Synchronize();

LoadApplication(new App());

This is CallDirectoryHandler :

var defaults = new NSUserDefaults("group.com.MyAppName", NSUserDefaultsType.SuiteName);
string phonesStr = defaults.StringForKey("CompanyContacts");

         Console.WriteLine("PhoneNumbers = " + phonesStr);

         string[] contactArray = phonesStr.Split(",");
         long[] phoneNumbers = new long[contactArray.Length];
         string[] labels = new string[contactArray.Length];

         for (int i = 0; i < contactArray.Length; i++)
         {
             string numberAndName = contactArray[i];
             long number = long.Parse(numberAndName.Split("-")[0]);
             string name = numberAndName.Split("-")[1];
             phoneNumbers[i] = number;
             labels[i] = name;
         }

         for (var i = 0; i < phoneNumbers.Length; i++)
         {
             long phoneNumber = phoneNumbers[i];
             string label = labels[i];
             context.AddIdentificationEntry(phoneNumber, label);
         }
dotnet-csharpazure-data-catalog
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello Muharrem.

I would suggest double checking your group name as it is easy to make mistype it.

Good luck.

0 Votes 0 ·

0 Answers