{"id":521,"date":"2023-02-25T15:38:40","date_gmt":"2023-02-25T07:38:40","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=521"},"modified":"2023-04-29T20:43:56","modified_gmt":"2023-04-29T12:43:56","slug":"react-native-learning-for-rn-and-ios-native-communication","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/react-native-learning-for-rn-and-ios-native-communication\/","title":{"rendered":"React Native\u5b66\u4e60\u4e4bRN\u4e0eiOS\u539f\u751f\u901a\u4fe1"},"content":{"rendered":"<p>iOS \u5e73\u53f0\u5f00\u53d1\u8bed\u8a00\u5206\u4e3a\uff1a<code>Objective-C<\/code>\u548c<code>Swift<\/code>\uff0c\u76ee\u524d React Native \u53ea\u80fd\u4e0e<code>Objective-C<\/code>\u4ee3\u7801\u4ea4\u4e92\uff0c\u4e0e<code>Swift<\/code>\u4ee3\u7801\u4ea4\u4e92\u5fc5\u987b\u5148\u4e0e<code>Objective-C<\/code>\u4ea4\u4e92\uff0c\u518d\u901a\u8fc7<code>Objective-C<\/code>\u4e0e<code>Swift<\/code>\u4ea4\u4e92\uff0c\u7531\u4e8e<code>Swift<\/code>\u7684\u67d0\u4e9b\u5148\u8fdb\u7279\u6027\uff0c\u8fd9\u79cd\u65b9\u5f0f\u7684\u6df7\u5408\u5f00\u53d1\u5b8c\u5168\u662f\u503c\u5f97\u7684\uff0c\u5e76\u4e0d\u4f1a\u6709\u6027\u80fd\u635f\u5931\u3002<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-h\">#import &quot;RCTBridgeModule.h&quot;  \/\/\u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u73b0\u5b9eRCTBridgeModule\u534f\u8bae\n#import &quot;RCTBridge.h&quot;  \/\/\u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u5b9e\u73b0\u5411RN\u4fa7\u53d1\u9001\u4e8b\u4ef6\n#import &quot;RCTEventDispatcher.h&quot;  \/\/\u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u5b9e\u73b0\u5411RN\u4fa7\u53d1\u9001\u4e8b\u4ef6<\/code><\/pre>\n<p>ExampleInterface.h<\/p>\n<pre><code class=\"language-h\">#import &lt;Foundation\/Foundation.h&gt;\n#import &quot;RCTBridgeModule.h&quot; \/\/ \u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u73b0\u5b9eRCTBridgeModule\u534f\u8bae\n#import &quot;RCTBridge.h&quot;   \/\/ \u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u5b9e\u73b0\u5411RN\u4fa7\u53d1\u9001\u4e8b\u4ef6\n#import &quot;RCTEventDispatcher.h&quot;  \/\/ \u5bfc\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u4ee5\u5b9e\u73b0\u5411RN\u4fa7\u53d1\u9001\u4e8b\u4ef6\n\n@interface ExampleInterface : NSObject&lt;RCTBridgeModule&gt;\n@property (nonatomic, strong)NSString *contactName;  \/\/ \u4fdd\u5b58\u8054\u7cfb\u4eba\u540d\u5b57\n@property (nonatomic, strong)NSString *contactPhoneNumber;  \/\/ \u4fdd\u5b58\u8054\u7cfb\u4eba\u7535\u8bdd\u53f7\u7801\n\n@end<\/code><\/pre>\n<p>ExampleInterface.m<\/p>\n<pre><code class=\"language-m\">#import &quot;ExampleInterface.h&quot;\n#import &quot;CallAdressbookViewController.h&quot;  \/\/\u8fd9\u662f\u5f00\u53d1\u8005\u4f7f\u7528Objective-C\u5f00\u53d1\u7684\u7c7b\u7684\u5934\u6587\u4ef6\n\n@interface ExampleInterface()\n@property (nonatomic, strong)NSDictionary *dic;\n\n@end\n@implementation ExampleInterface\n- (instancetype) init{\n    return self;\n}\n- (NSString *)contactName{\n    if (!_contactName) {\n        _contactName = @&quot;&quot;;\n    }\n    return _contactName;\n}\n\n@synthesize bridge=_bridge;\n\/\/ \u9664\u4e86\u73b0\u5b9eRCTBridegModule\u534f\u8bae\u5916\uff0c\u7c7b\u8fd8\u9700\u8981\u5305\u542bRCT_EXPORT_MODELE()\u5b8f\u3002\u8fd9\u4e2a\u5b8f\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u53c2\u6570\u7528\u6765\u6307\u5b9a\u5728js\u4e2d\u8bbf\u95ee\u8fd9\u4e2a\u6a21\u5757\u7684\u540d\u5b57\n\/\/ \u901a\u5e38\u4e0d\u6307\u5b9a\u540d\u5b57\uff0c\u9ed8\u8ba4\u4f7f\u7528Objective-C\u7c7b\u7684\u540d\u5b57\nRCT_EXPORT_MODULE();\n\n\/\/ \u4f7f\u7528RCT_EXPORT_METHOD()\u5b8f\u58f0\u660e\u9700\u8981\u63d0\u4f9b\u7ed9RN\u7ec4\u4ef6\u8c03\u7528\u7684\u65b9\u6cd5\nRCT_EXPORT_METHOD(sendMessage: (NSString *)msg)\n{\n    \/\/ \u5728\u8c03\u8bd5\u7a97\u53e3\u4e2d\u6253\u5370React Native\u8c03\u7528\u6b64\u51fd\u6570\u65f6\u643a\u5e26\u7684\u53c2\u6570\n    NSLog(@&quot;\u6536\u5230\u7684\u6765\u81eaReact Native\u7684\u6d88\u606f:%@&quot;, msg);\n\n    \/\/ \u68c0\u6d4b\u6536\u5230\u7684\u6d88\u606f\u662f\u5426\u4e3ajson\u683c\u5f0f\n    NSData *data = [msg dataUsingEncoding:NSUTF8StringEncoding];\n    NSError *error;\n    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&amp;error];\n\n    if (error != nil) {\n        NSLog(@&quot;\u89e3\u6790\u9519\u8bef\uff1a%@&quot;, error);\n    } else {\n        \/\/ \u6ca1\u6709\u9519\u8bef\u5219\u901a\u77e5React Native\uff0c\u53d1\u9001\u6d88\u606f\u7ed9React Native\n        [self.bridge.eventDispatcher sendAppEventWithName:@&quot;NativeModuleMsg&quot; body:@{@&quot;message&quot;:@&quot;\u53d1\u9001\u6d88\u606f\u901a\u77e5React Native - \u6ca1\u6709\u89e3\u6790\u9519\u8bef&quot;}];\n    }\n\n    \/\/ \u68c0\u6d4b\u6d88\u606f\u7684msgType\u662f\u5426\u4e3apickContact\uff0c\u5982\u679c\u662f\u5219\u521d\u59cb\u5316\u6311\u9009\u8054\u7cfb\u4eba\u754c\u9762\n    NSString *login = [dic objectForKey:@&quot;msgType&quot;];\n\n    if ([login isEqualToString:@&quot;pickContact&quot;]) [self callAddress];\n}\n\n- (void)callAddress {\n    UIViewController *controller = (UIViewController*)[[[UIApplication sharedApplication]keyWindow] rootViewController];\n\n    CallAdressbookViewController *addressbookViewController = [[CallAdressbookViewController alloc] init];\n    [controller presentViewController:addressbookViewController animated:YES completion:nil];\n\n    self.contactName = addressbookViewController.contactName;\n\n    self.contactPhoneNumber = addressbookViewController.contactPhoneNumber;\n\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(calendarEventReminderReceived:) name:@&quot;Num&quot; object:nil];\n}\n\n- (dispatch_queue_t)methodQueue\n{\n    return dispatch_get_main_queue();\n}\n\n- (void)calendarEventReminderReceived:(NSNotification *)notification{\n    self.contactPhoneNumber = notification.object;\n    self.contactName = notification.userInfo[@&quot;name&quot;];\n    \/\/ \u53bb\u9664\u83b7\u53d6\u5230\u7684\u7535\u8bdd\u53f7\u7801\u4e2d\u7684\u7279\u6b8a\u5b57\u7b26\n    self.contactPhoneNumber=[self.contactPhoneNumber stringByReplacingOccurrencesOfString:@&quot;-&quot; withString:@&quot;&quot;];\n    self.contactPhoneNumber = [self.contactPhoneNumber stringByReplacingOccurrencesOfString:@&quot;(&quot; withString:@&quot;&quot;];\n    self.contactPhoneNumber = [self.contactPhoneNumber stringByReplacingOccurrencesOfString:@&quot;)&quot; withString:@&quot;&quot;];\n    self.contactPhoneNumber = [self.contactPhoneNumber stringByReplacingOccurrencesOfString:@&quot; &quot; withString:@&quot;&quot;];\n\n    NSMutableDictionary *dic=[[NSMutableDictionary alloc] init];\n\n    [dic setObject:@&quot;pickContactResult&quot; forKey:@&quot;msgType&quot;];\n\n    if(self.contactPhoneNumber==nil){\n        self.contactPhoneNumber=@&quot;&quot;;\n    }\n\n    [dic setObject:self.contactPhoneNumber forKey:@&quot;peerNumber&quot;];\n\n    if(self.contactName == nil){\n        self.contactName = @&quot;&quot;;\n    }\n\n    \/\/ \u7ec4\u88c5\u53d1\u9001\u7ed9rn\u4fa7\u7684\u6d88\u606f\n\n    [dic setObject:self.contactName forKey:@&quot;displayName&quot;];\n    self.dic = [dic copy];\n    NSError *error = [[NSError alloc] init];\n    NSData *data = [NSJSONSerialization dataWithJSONObject:self.dic options:0 error:&amp;error];\n    NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n\n    \/\/ \u5411React Native\u53d1\u9001\u6d88\u606f\n    [self.bridge.eventDispatcher sendAppEventWithName:@&quot;NativeModuleMsg&quot; body:@{@&quot;message&quot;:str}];\n}\n\n@end<\/code><\/pre>\n<p>CallAdressbookViewController.h<\/p>\n<pre><code class=\"language-h\">#import &lt;Foundation\/Foundation.h&gt;\n#import &lt;UIKit\/UIKit.h&gt;\n\n@interface CallAdressbookViewController : UIViewController\n\n@property (nonatomic, strong)NSString *contactName;\n@property (nonatomic, strong)NSString *contactPhoneNumber;\n\n@end<\/code><\/pre>\n<p>CallAdressbookViewController.m<\/p>\n<pre><code class=\"language-m\">#import &quot;CallAdressbookViewController.h&quot;\n#import &lt;AddressBookUI\/AddressBookUI.h&gt;\n#import &lt;AddressBook\/AddressBook.h&gt;\n#import &quot;AppDelegate.h&quot;\n\n@class CallAdressbookViewController;\n\n@interface CallAdressbookViewController()&lt;ABPeoplePickerNavigationControllerDelegate&gt;\n\n@end\n\n@implementation CallAdressbookViewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.view.backgroundColor = [UIColor whiteColor];\n\n    ABPeoplePickerNavigationController *peoplePicker = [[ABPeoplePickerNavigationController alloc] init];\n    peoplePicker.peoplePickerDelegate = self;\n\n    [self presentViewController:peoplePicker animated:YES completion:nil];\n    [self authoriy];\n}\n\n\/\/ \u6388\u6743\u6ce8\u518c\n- (void)authoriy {\n    \/\/ \u68c0\u67e5\u662f\u5426\u662fiOS6\n    if (&amp;ABAddressBookRequestAccessWithCompletion != NULL) {\n        \/\/ iOS6\u7248\u672c\u4e2d\n        ABAddressBookRef abRef = ABAddressBookCreateWithOptions(NULL, NULL);\n        if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {\n            \/\/ \u5982\u679c\u4ece\u672a\u7533\u8bf7\u8fc7\u6743\u9650\uff0c\u7533\u8bf7\u6743\u9650\n            ABAddressBookRequestAccessWithCompletion(abRef, ^(bool granted, CFErrorRef error) {\n                \/\/ \u6839\u636egranted\u53c2\u6570\u5224\u65ad\u7528\u6237\u662f\u5426\u540c\u610f\u6388\u4e88\u6743\u9650\u3001\n                if (granted) {\n                    \/\/ \u67e5\u8be2\u6240\u6709\uff0c\u5373\u663e\u793a\u901a\u8baf\u5f55\u6240\u6709\u8054\u7cfb\u4eba\n                    [self getContacts];\n                }\n            });\n        } else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {\n            \/\/ \u5982\u679c\u6743\u9650\u5df2\u7ecf\u88ab\u6388\u4e88\uff0c\u67e5\u8be2\u6240\u6709\uff0c\u5373\u663e\u793a\u901a\u8baf\u5f55\u6240\u6709\u8054\u7cfb\u4eba\n            [self getContacts];\n        } else {\n            \/\/ \u5982\u679c\u6743\u9650\u88ab\u6536\u56de\uff0c\u63d0\u9192\u7528\u6237\u53bb\u7cfb\u7edf\u8bbe\u7f6e\u83dc\u5355\u4e2d\u6253\u5f00\n            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@&quot;\u6e29\u99a8\u63d0\u793a&quot; message:@&quot;\u8bf7\u60a8\u8bbe\u7f6e\u5141\u8bb8APP\u8bbf\u95ee\u60a8\u7684\u901a\u8baf\u5f55\\n\u8bbe\u7f6e&gt;\u901a\u7528&gt;\u8bbf\u95ee\u6743\u9650&quot; delegate:self cancelButtonTitle:@&quot;&quot; otherButtonTitles:nil, nil];\n            [alert show];\n            return;\n        }\n        if (abRef) {\n            CFRelease(abRef);\n        }\n    }\n}\n\n\/\/ \u83b7\u53d6\u5168\u90e8\u901a\u8baf\u5f55\u5355\u5143\u4fe1\u606f\n- (void)getContacts {\n    ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);\n    \/\/ 1.\u53d6\u5168\u90e8\u8054\u7cfb\u4eba\n    CFArrayRef allPerson = ABAddressBookCopyArrayOfAllPeople(addressBook);\n    CFIndex number = ABAddressBookGetPersonCount(addressBook);\n    \/\/ \u8fdb\u884c\u904d\u5386\n    for (NSInteger i = 0; i &lt; number; i ++) {\n        ABRecordRef people = CFArrayGetValueAtIndex(allPerson, i);\n        \/\/ 2.\u83b7\u53d6\u8054\u7cfb\u4eba\u7684\u59d3\u540d\n        NSString *firstName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonFirstNameProperty));\n        NSString *middleName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonMiddleNameProperty));\n        NSString *lastName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonLastNameProperty));\n        NSString *nameString  = nil;\n        if (firstName.length != 0) nameString = firstName;\n        if (middleName.length != 0) nameString = [nameString stringByAppendingString:middleName];\n        if (lastName.length != 0) nameString = [nameString stringByAppendingString:lastName];\n        \/\/ if (firstName.length == 0 || lastName.length == 0) nameString = firstName ? [NSString stringWithFormat:@&quot;%@%@&quot; , firstName(lastName ? lastName : @&quot;&quot;) ] : @&quot;&quot;;\n        \/\/ nameString = middleName.length ?  [NSString stringWithFormat:@&quot;%@%@%@&quot;, lastName, middleName, firstName] : [NSString stringWithFormat:@&quot;%@%@&quot;, lastName, firstName];\n        NSLog(@&quot;\u59d3\u540d\uff1a%@&quot;, nameString);\n\n        \/\/ 3.\u83b7\u53d6\u8054\u7cfb\u4eba\u7684\u5934\u50cf\u56fe\u7247\n        \/\/ NSData *userImageData = (__bridge NSData *)(ABPersonCopyImageData(people));\n        \/\/ UIImage *userImage = [UIImage imageWithData:userImageData];\n        \/\/ NSData *data = UIImageJPEGRepresentation(userImage, 1.0);\n        \/\/ NSString *userImageString= [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];\n        \/\/ NSURL *userImageURL  = [NSURL URLWithString:userImageString];\n        \/\/ NSLog(@&quot;\u5934\u50cf\uff1a%@&quot;, userImageURL);\n\n        \/\/ 4.\u83b7\u53d6\u8054\u7cfb\u4eba\u7535\u8bdd\n        ABMutableMultiValueRef phoneMutil = ABRecordCopyValue(people, kABPersonPhoneProperty);\n        NSMutableArray *phones = [[NSMutableArray alloc] init];\n        for (int  i = 0; i &lt; ABMultiValueGetCount(phoneMutil); i ++) {\n            \/\/ NSString *phone = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(phoneMutil, i));\n            NSString *phoneLabel = (__bridge NSString *)(ABMultiValueCopyLabelAtIndex(phoneMutil, i));\n            \/\/ if (phone.length  &lt;  11) {\n                \/\/ break;\n            \/\/ }\n            if ([phoneLabel isEqualToString:@&quot;_$!&lt;Mobile&gt;!$_&quot;]) {\n                [phones addObject:(__bridge id _Nonnull)(ABMultiValueCopyValueAtIndex(phoneMutil, i))];\n            } else {\n                [phones addObject:(__bridge id _Nonnull)(ABMultiValueCopyValueAtIndex(phoneMutil, i))];\n            }\n        }\n        for (int  i = 0; i &lt; phones.count; i ++) {\n            NSLog(@&quot;\u7535\u8bdd%d\uff1a%@&quot;, i+1, phones[i]);\n        }\n    }\n}\n\n#pragma mark - ABPeoplePickerNavigationControllerDelegate\n- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {\n    ABMultiValueRef valuesRef = ABRecordCopyValue(person, kABPersonPhoneProperty);\n    CFIndex index = ABMultiValueGetIndexForIdentifier(valuesRef, identifier);\n    CFStringRef value = ABMultiValueCopyValueAtIndex(valuesRef, index);\n\n    \/\/ \u83b7\u53d6\u8054\u7cfb\u4eba\u59d3\u540d\n    \/\/ ABRecordRef people = CFArrayGetValueAtIndex(valuesRef, index);\n    \/\/ NSString *firstName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonFirstNameProperty));\n    \/\/ NSString *middleName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonMiddleNameProperty));\n    \/\/ NSString *lastName = (__bridge NSString *)(ABRecordCopyValue(people, kABPersonLastNameProperty));\n    \/\/ NSString *nameString  = nil;\n    \/\/ if (firstName.length != 0) nameString = firstName;\n    \/\/ if (middleName.length != 0) nameString = [nameString stringByAppendingString:middleName];\n    \/\/ if (lastName.length != 0) nameString = [nameString stringByAppendingString:lastName];\n    \/\/ if (firstName.length == 0 || lastName.length == 0) nameString = firstName ? [NSString stringWithFormat:@&quot;%@%@&quot; , firstName(lastName ? lastName : @&quot;&quot;) ] : @&quot;&quot;;\n    \/\/ nameString = middleName.length ?  [NSString stringWithFormat:@&quot;%@%@%@&quot;, lastName, middleName, firstName] : [NSString stringWithFormat:@&quot;%@%@&quot;, lastName, firstName];\n\n    CFStringRef anFullName = ABRecordCopyCompositeName(person);\n\n    [peoplePicker dismissViewControllerAnimated:YES completion:^{\n        [self dismissViewControllerAnimated:YES completion:^{\n            self.contactPhoneNumber =  (__bridge NSString *)(value);\n            self.contactName = (__bridge NSString *)(anFullName);\n\n            [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;Num&quot; object:self.contactPhoneNumber userInfo: @{@&quot;name&quot; : self.contactName}];\n\n            NSLog(@&quot;%@ %@&quot;, self.contactPhoneNumber, self.contactName);\n        }];\n    }];\n}\n\n- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {\n    [peoplePicker dismissViewControllerAnimated:YES completion:^ {\n        \/\/ \u83b7\u53d6\u8054\u7cfb\u4eba\u59d3\u540d\n        \/\/ NSString *firstName = (__bridge NSString *)(ABRecordCopyValue(person, kABPersonFirstNameProperty));\n        \/\/ NSString *middleName = (__bridge NSString *)(ABRecordCopyValue(person, kABPersonMiddleNameProperty));\n        \/\/ NSString *lastName = (__bridge NSString *)(ABRecordCopyValue(person, kABPersonLastNameProperty));\n        \/\/ NSString *nameString  = nil;\n        \/\/ if (firstName.length != 0) nameString = firstName;\n        \/\/ if (middleName.length != 0) nameString = [nameString stringByAppendingString:middleName];\n        \/\/ if (lastName.length != 0) nameString = [nameString stringByAppendingString:lastName];\n        \/\/ if (firstName.length == 0 || lastName.length == 0) nameString = firstName ? [NSString stringWithFormat:@&quot;%@%@&quot; , firstName(lastName ? lastName : @&quot;&quot;) ] : @&quot;&quot;;\n        \/\/ nameString = middleName.length ?  [NSString stringWithFormat:@&quot;%@%@%@&quot;, lastName, middleName, firstName] : [NSString stringWithFormat:@&quot;%@%@&quot;, lastName, firstName];\n\n        CFStringRef anFullName = ABRecordCopyCompositeName(person);\n\n        [self dismissViewControllerAnimated:YES completion:^{\n            ABMultiValueRef phones = ABRecordCopyValue(person,kABPersonPhoneProperty);\n            NSString *phone  = nil;\n            for (int i = 0; i &lt; ABMultiValueGetCount(phones); i++) {\n                phone = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(phones, i));\n                NSLog(@&quot;telephone = %@&quot;,phone);\n            }\n            self.contactPhoneNumber = phone;\n            self.contactName = (__bridge NSString *)(anFullName);\n\n            [[NSNotificationCenter defaultCenter] postNotificationName:@&quot;Num&quot; object:self.contactPhoneNumber userInfo: @{@&quot;name&quot; : self.contactName}];\n\n            NSLog(@&quot;%@ %@&quot;, self.contactPhoneNumber, self.contactName);\n        }];\n    }];\n    return YES;\n}\n\n- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker{\n    [self dismissViewControllerAnimated:YES completion:^{\n        [self dismissViewControllerAnimated:YES completion:nil];\n    }];\n}\n\n- (void)didReceiveMemoryWarning {\n    [super didReceiveMemoryWarning];\n    \/\/ Dispose of any resources that can be recreated.\n}\n\n@end<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>iOS \u5e73\u53f0\u5f00\u53d1\u8bed\u8a00\u5206\u4e3a\uff1aObjective-C\u548cSwift\uff0c\u76ee\u524d React Native \u53ea\u80fd\u4e0eObjec [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[163],"tags":[],"class_list":["post-521","post","type-post","status-publish","format-standard","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=521"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/521\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}