app center;增加發送ping的秒

This commit is contained in:
Caiyanpeng committed 2021-11-12 16:21:13 +08:00
1 parent 1bd1ffdb5a
commit d754ff3b15
719 files changed
+34172 -2875

No files matched your search

@@ -0,0 +1,88 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity
{
public static class DeviceHelper
{
public static Device Convert(IntPtr devicePtr)
{
if (devicePtr == IntPtr.Zero)
{
return null;
}
var sdkName = app_center_unity_device_sdk_name(devicePtr);
var sdkVersion = app_center_unity_device_sdk_version(devicePtr);
var model = app_center_unity_device_model(devicePtr);
var oemName = app_center_unity_device_oem_name(devicePtr);
var osName = app_center_unity_device_os_name(devicePtr);
var osVersion = app_center_unity_device_os_version(devicePtr);
var osBuild = app_center_unity_device_os_build(devicePtr);
var osApiLevel = app_center_unity_device_os_api_level(devicePtr);
var locale = app_center_unity_device_locale(devicePtr);
var timeZoneOffset = app_center_unity_device_time_zone_offset(devicePtr);
var screenSize = app_center_unity_device_screen_size(devicePtr);
var appVersion = app_center_unity_device_app_version(devicePtr);
var carrierName = app_center_unity_device_carrier_name(devicePtr);
var carrierCountry = app_center_unity_device_carrier_country(devicePtr);
var appBuild = app_center_unity_device_app_build(devicePtr);
var appNamespace = app_center_unity_device_app_namespace(devicePtr);
return new Device(sdkName, sdkVersion, model, oemName, osName, osVersion, osBuild, osApiLevel,
locale, timeZoneOffset, screenSize, appVersion, carrierName, carrierCountry,
appBuild, appNamespace);
}
[DllImport("__Internal")]
private static extern string app_center_unity_device_sdk_name(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_sdk_version(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_model(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_oem_name(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_os_name(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_os_version(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_os_build(IntPtr device);
[DllImport("__Internal")]
private static extern int app_center_unity_device_os_api_level(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_locale(IntPtr device);
[DllImport("__Internal")]
private static extern int app_center_unity_device_time_zone_offset(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_screen_size(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_app_version(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_carrier_name(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_carrier_country(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_app_build(IntPtr device);
[DllImport("__Internal")]
private static extern string app_center_unity_device_app_namespace(IntPtr device);
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1cbedebc3603346ccba2733a839112d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
extern "C" const char* app_center_unity_device_sdk_name(void* device);
extern "C" const char* app_center_unity_device_sdk_version(void* device);
extern "C" const char* app_center_unity_device_model(void* device);
extern "C" const char* app_center_unity_device_oem_name(void* device);
extern "C" const char* app_center_unity_device_os_name(void* device);
extern "C" const char* app_center_unity_device_os_version(void* device);
extern "C" const char* app_center_unity_device_os_build(void* device);
extern "C" int app_center_unity_device_os_api_level(void* device);
extern "C" const char* app_center_unity_device_locale(void* device);
extern "C" int app_center_unity_device_time_zone_offset(void* device);
extern "C" const char* app_center_unity_device_screen_size(void* device);
extern "C" const char* app_center_unity_device_app_version(void* device);
extern "C" const char* app_center_unity_device_carrier_name(void* device);
extern "C" const char* app_center_unity_device_carrier_country(void* device);
extern "C" const char* app_center_unity_device_app_build(void* device);
extern "C" const char* app_center_unity_device_app_namespace(void* device);
@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: bad688f7eba404cc4a90a8a0e0a1263f
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,102 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import <AppCenter/AppCenter.h>
#import "DeviceHelper.h"
#import "NSStringHelper.h"
const char* app_center_unity_device_sdk_name(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo sdkName]);
}
const char* app_center_unity_device_sdk_version(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo sdkVersion]);
}
const char* app_center_unity_device_model(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo model]);
}
const char* app_center_unity_device_oem_name(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo oemName]);
}
const char* app_center_unity_device_os_name(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo osName]);
}
const char* app_center_unity_device_os_version(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo osVersion]);
}
const char* app_center_unity_device_os_build(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo osBuild]);
}
int app_center_unity_device_os_api_level(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return [[deviceInfo osApiLevel] intValue];
}
const char* app_center_unity_device_locale(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo locale]);
}
int app_center_unity_device_time_zone_offset(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return [[deviceInfo timeZoneOffset] intValue];
}
const char* app_center_unity_device_screen_size(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo screenSize]);
}
const char* app_center_unity_device_app_version(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo appVersion]);
}
const char* app_center_unity_device_carrier_name(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo carrierName]);
}
const char* app_center_unity_device_carrier_country(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo carrierCountry]);
}
const char* app_center_unity_device_app_build(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo appBuild]);
}
const char* app_center_unity_device_app_namespace(void* device)
{
MSACDevice *deviceInfo = (__bridge MSACDevice*)device;
return appcenter_unity_ns_string_to_cstr([deviceInfo appNamespace]);
}
@@ -0,0 +1,34 @@
fileFormatVersion: 2
guid: 03b9cfe7b6a4b4b70acf8694de18052e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Microsoft.AppCenter.Unity.Internal.Utility
{
public class NSDateHelper
{
public static IntPtr DateTimeConvert(DateTime date)
{
var unixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
var timeSpan = date - unixStartTime;
var interval = (long)(timeSpan.TotalSeconds);
return appcenter_unity_ns_date_convert(interval);
}
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_ns_date_convert(long interval);
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3efba9dacbfa347588fdde9d1cd911ac
timeCreated: 1498578955
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#ifndef NS_DATE_HELPER_H
#define NS_DATE_HELPER_H
#import <Foundation/Foundation.h>
extern "C" void* appcenter_unity_ns_date_convert(long interval);
#endif
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: ab35984e9d22f4c5a93a2dd4af548412
timeCreated: 1498584208
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import "NSDateHelper.h"
#import <Foundation/Foundation.h>
void* appcenter_unity_ns_date_convert(long interval)
{
return (void *)CFBridgingRetain([[NSDate alloc] initWithTimeIntervalSince1970:interval]);
}
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: dc5f65baccfe345be8fd3b0531c51edd
timeCreated: 1498584195
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS && !UNITY_EDITOR
using System;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity.Internal.Utility
{
public static partial class NSErrorHelper
{
public static Exception ToSystemException(IntPtr nsErrorPtr)
{
if (nsErrorPtr == IntPtr.Zero)
{
return null;
}
var domain = app_center_unity_nserror_domain(nsErrorPtr);
var errorCode = app_center_unity_nserror_code(nsErrorPtr);
var description = app_center_unity_nserror_description(nsErrorPtr);
return new Exception(string.Format("Domain: {0}, error code: {1}, description: {2}", domain, errorCode, description));
}
[DllImport("__Internal")]
private static extern string app_center_unity_nserror_domain(IntPtr error);
[DllImport("__Internal")]
private static extern long app_center_unity_nserror_code(IntPtr error);
[DllImport("__Internal")]
private static extern string app_center_unity_nserror_description(IntPtr error);
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f73030502bdd74d458f10a7c1a597e3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
extern "C" const char* app_center_unity_nserror_domain(void* error);
extern "C" long app_center_unity_nserror_code(void* error);
extern "C" const char* app_center_unity_nserror_description(void* error);
@@ -0,0 +1,24 @@
fileFormatVersion: 2
guid: 23252b01a9d2f4f40ba6f2f0db9efbd5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import "NSStringHelper.h"
#import "NSErrorHelper.h"
const char* app_center_unity_nserror_domain(void* error)
{
NSError *nsError = (__bridge NSError*)error;
return appcenter_unity_ns_string_to_cstr([nsError domain]);
}
long app_center_unity_nserror_code(void* error)
{
NSError *nsError = (__bridge NSError*)error;
return [nsError code];
}
const char* app_center_unity_nserror_description(void* error)
{
NSError *nsError = (__bridge NSError*)error;
return appcenter_unity_ns_string_to_cstr([nsError localizedDescription]);
}
@@ -0,0 +1,34 @@
fileFormatVersion: 2
guid: b122ae60c2ba54e659d9568ad78400e7
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS
using System;
using System.Runtime.InteropServices;
namespace Microsoft.AppCenter.Unity.Internal.Utility
{
public class NSNumberHelper
{
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_nsnumber_convert_int(int val);
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_nsnumber_convert_long(long val);
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_nsnumber_convert_float(float val);
[DllImport("__Internal")]
private static extern IntPtr appcenter_unity_nsnumber_convert_double(double val);
public static IntPtr Convert(int val)
{
return appcenter_unity_nsnumber_convert_int(val);
}
public static IntPtr Convert(long val)
{
return appcenter_unity_nsnumber_convert_long(val);
}
public static IntPtr Convert(float val)
{
return appcenter_unity_nsnumber_convert_float(val);
}
public static IntPtr Convert(double val)
{
return appcenter_unity_nsnumber_convert_double(val);
}
//TODO how to support 'decimal'?
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f53b041fddc194840aae7635b39bfde6
timeCreated: 1498578955
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#ifndef NS_NUMBER_HELPER_H
#define NS_NUMBER_HELPER_H
#import <Foundation/Foundation.h>
extern "C" void* appcenter_unity_nsnumber_convert_int(int val);
extern "C" NSNumber* appcenter_unity_nsnumber_convert_long(long val);
extern "C" NSNumber* appcenter_unity_nsnumber_convert_float(float val);
extern "C" NSNumber* appcenter_unity_nsnumber_convert_double(double val);
#endif
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 80eab99a01c404cea937a54c788f7f0c
timeCreated: 1498583134
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import "NSNumberHelper.h"
#import <Foundation/Foundation.h>
void* appcenter_unity_nsnumber_convert_int(int val)
{
return (__bridge void*)[NSNumber numberWithInt:val];
}
NSNumber* appcenter_unity_nsnumber_convert_long(long val)
{
return [NSNumber numberWithLong:val];
}
NSNumber* appcenter_unity_nsnumber_convert_float(float val)
{
return [NSNumber numberWithFloat:val];
}
NSNumber* appcenter_unity_nsnumber_convert_double(double val)
{
return [NSNumber numberWithDouble:val];
}
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 0eecac2606cb14ec6a20fd15ec08feb2
timeCreated: 1498583125
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if UNITY_IOS
using System.Runtime.InteropServices;
using System;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Unity.Internal.Utility
{
public class NSStringDictionaryHelper
{
public static Dictionary<string, string> NSDictionaryConvert(IntPtr nsDictionary)
{
var length = appcenter_unity_ns_dictionary_get_length(nsDictionary);
var dictionary = new Dictionary<string, string>();
for (int i = 0; i < length; ++i)
{
var key = appcenter_unity_ns_string_dictionary_get_key_at_idx(nsDictionary, i);
var value = appcenter_unity_ns_string_dictionary_get_value_for_key(nsDictionary, key);
dictionary[key] = value;
}
return dictionary;
}
[DllImport("__Internal")]
private static extern string appcenter_unity_ns_string_dictionary_get_key_at_idx(IntPtr dictionary, int idx);
[DllImport("__Internal")]
private static extern string appcenter_unity_ns_string_dictionary_get_value_for_key(IntPtr dictionary, string key);
[DllImport("__Internal")]
private static extern uint appcenter_unity_ns_dictionary_get_length(IntPtr dictionary);
}
}
#endif
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4b38da4320f354ed2af0a1af947badd9
timeCreated: 1498075853
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#ifndef NS_STRING_DICTIONARY_HELPER_H
#define NS_STRING_DICTIONARY_HELPER_H
#import <Foundation/Foundation.h>
extern "C" const char* appcenter_unity_ns_string_dictionary_get_key_at_idx(NSDictionary *dictionary, int idx);
extern "C" const char* appcenter_unity_ns_string_dictionary_get_value_for_key(NSDictionary *dictionary, char* key);
extern "C" size_t appcenter_unity_ns_dictionary_get_length(NSDictionary *dictionary);
extern "C" NSDictionary* appcenter_unity_create_ns_string_dictionary(char** keys, char** values, int count);
#endif
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 5d5be32a195b94d58b0410f7d8eb3e82
timeCreated: 1498062779
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import "NSStringDictionaryHelper.h"
#import "NSStringHelper.h"
#import <Foundation/Foundation.h>
const char *appcenter_unity_ns_string_dictionary_get_key_at_idx(NSDictionary *dictionary, int idx) {
id sortKeys = ^(NSString *key1, NSString *key2) {
return [key1 compare:key2];
};
NSArray *keys = [[dictionary allKeys] sortedArrayUsingComparator:sortKeys];
return appcenter_unity_ns_string_to_cstr(keys[idx]);
}
const char *appcenter_unity_ns_string_dictionary_get_value_for_key(NSDictionary *dictionary, char *key) {
NSString *keyString = [NSString stringWithUTF8String:key];
return appcenter_unity_ns_string_to_cstr([dictionary objectForKey:keyString]);
}
NSDictionary *appcenter_unity_create_ns_string_dictionary(char **keys, char **values, int count) {
if (count == 0) {
return nil;
}
// Convert the two arrays to a single dictionary
NSMutableDictionary<NSString *, NSString *> *nsdictionary = [[NSMutableDictionary alloc] initWithCapacity:count];
for (int i = 0; i < count; ++i) {
NSString *key = appcenter_unity_cstr_to_ns_string(keys[i]);
NSString *value = appcenter_unity_cstr_to_ns_string(values[i]);
[nsdictionary setValue:value forKey:key];
}
return nsdictionary;
}
size_t appcenter_unity_ns_dictionary_get_length(NSDictionary *dictionary) { return [dictionary count]; }
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 21e289077520b433ca6d72c25f19bcbb
timeCreated: 1498062777
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#ifndef NS_STRING_HELPER_H
#define NS_STRING_HELPER_H
#import <Foundation/Foundation.h>
extern "C" const char* appcenter_unity_ns_string_to_cstr(NSString* nsstring);
extern "C" NSString* appcenter_unity_cstr_to_ns_string(const char* str);
#endif
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 90801404dc9c24b02802066bad5dc732
timeCreated: 1498063641
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#import "NSStringHelper.h"
#import <Foundation/Foundation.h>
const char* appcenter_unity_ns_string_to_cstr(NSString* nsstring)
{
if (!nsstring)
{
return NULL;
}
// It seems that with (at least) IL2CPP, when returning a char* that is to be
// converted to a System.String in C#, the char array is freed - which causes
// a double-deallocation if ARC also tries to free it. To prevent this, we
// must return a manually allocated copy of the string returned by "UTF8String"
const char *cstring = [nsstring UTF8String];
size_t cstringLength = strlen(cstring) + 1; // +1 for '\0'
char *cstring_copy = (char*)malloc(cstringLength);
strncpy(cstring_copy, cstring, cstringLength);
return cstring_copy;
}
NSString* appcenter_unity_cstr_to_ns_string(const char* str)
{
return str ? [NSString stringWithUTF8String:str] : nil;
}
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 690b05b14d3e640429af5eaacfdec2ca
timeCreated: 1498063660
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
iPhone: iOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant: