Skip to content

Commit 09fe8a9

Browse files
committed
CloudKit开发
1 parent 77b25d9 commit 09fe8a9

6 files changed

Lines changed: 158 additions & 0 deletions

File tree

Plugins/iOS/CloudKit.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/iOS/CloudKit/CKRecord.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using CKRecordType = System.String;
4+
5+
namespace iOSNativePlugin.CloudKit
6+
{
7+
public class CKRecord
8+
{
9+
readonly IntPtr handle;
10+
[DllImport("__Internal")] static extern void ReleaseCKRecord(IntPtr handle);
11+
12+
~CKRecord()
13+
{
14+
ReleaseCKRecord(handle);
15+
}
16+
17+
/// <summary>
18+
/// - (instancetype)initWithRecordType:(CKRecordType)recordType;
19+
/// <para>Creates a new record of the specified type.</para>
20+
/// </summary>
21+
/// <param name="recordType">A string that represents the type of record that you want to create. You can’t change the record type after initialization. You define the record types that your app supports and use them to distinguish between records with different types of data. This parameter must not be nil or contain an empty string.
22+
/// <para>A record type must consist of one or more alphanumeric characters and must start with a letter. CloudKit permits the use of underscores, but not spaces.</para></param>
23+
/// <link>https://developer.apple.com/documentation/cloudkit/ckrecord/1462225-initwithrecordtype?language=objc</link>
24+
public CKRecord(CKRecordType recordType)
25+
{
26+
handle = InitCKRecord(recordType);
27+
}
28+
[DllImport("__Internal")] static extern IntPtr InitCKRecord(CKRecordType recordType);
29+
30+
}
31+
}

Plugins/iOS/CloudKit/CKRecord.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/iOS/CloudKit/Native.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#import <CloudKit/CloudKit.h>
2+
3+
extern "C"
4+
{
5+
6+
CKRecord* InitCKRecord(const char* recordType){
7+
CKRecord* record = [[CKRecord alloc] initWithRecordType:[NSString stringWithUTF8String:recordType]];
8+
return [record retain]; // 防止指针被回收
9+
}
10+
11+
void ReleaseCKRecord(CKRecord* handle){
12+
delete handle;
13+
}
14+
}

Plugins/iOS/CloudKit/Native/CloudKit.mm.meta

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)