{"id":8316,"date":"2023-11-08T12:33:22","date_gmt":"2023-11-08T04:33:22","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=8316"},"modified":"2023-11-08T12:33:22","modified_gmt":"2023-11-08T04:33:22","slug":"ios-%e6%89%93%e5%8c%85%e6%b8%a0%e9%81%93%e7%bb%9f%e8%ae%a1%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/8316\/","title":{"rendered":"ios \u6253\u5305\u6e20\u9053\u7edf\u8ba1\u600e\u4e48\u505a\uff1f"},"content":{"rendered":"

iOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u662f\u6307\u5728\u53d1\u5e03iOS\u5e94\u7528\u65f6\uff0c\u901a\u8fc7\u4e00\u79cd\u65b9\u5f0f\u5728\u5e94\u7528\u4e2d\u96c6\u6210\u7edf\u8ba1\u4ee3\u7801\uff0c\u4ee5\u4fbf\u76d1\u6d4b\u7528\u6237\u6765\u6e90\u548c\u5206\u6790\u6e20\u9053\u7684\u6548\u679c\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecdiOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u7684\u539f\u7406\u548c\u5177\u4f53\u6b65\u9aa4\u3002<\/p>\n

1. \u539f\u7406\u4ecb\u7ecd<\/p>\n

iOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u7684\u539f\u7406\u662f\u5728\u5e94\u7528\u4e2d\u5d4c\u5165\u4e00\u4e2a\u552f\u4e00\u7684\u6807\u8bc6\u7b26\uff0c\u7528\u6765\u8868\u793a\u5e94\u7528\u7684\u6e20\u9053\u6765\u6e90\u3002\u5f53\u7528\u6237\u5b89\u88c5\u5e94\u7528\u65f6\uff0c\u7edf\u8ba1\u4ee3\u7801\u4f1a\u81ea\u52a8\u83b7\u53d6\u8fd9\u4e2a\u6807\u8bc6\u7b26\uff0c\u5e76\u5c06\u5176\u53d1\u9001\u5230\u670d\u52a1\u5668\u8fdb\u884c\u7edf\u8ba1\u3002<\/p>\n

2. \u5177\u4f53\u6b65\u9aa4<\/p>\n

\u6b65\u9aa4\u4e00\uff1a\u83b7\u53d6\u6e20\u9053\u6807\u8bc6\u7b26<\/p>\n

\u5728\u5e94\u7528\u4e2d\u83b7\u53d6\u6e20\u9053\u6807\u8bc6\u7b26\u7684\u65b9\u5f0f\u6709\u591a\u79cd\uff0c\u5e38\u89c1\u7684\u65b9\u5f0f\u5305\u62ec\u4f7f\u7528App Store\u7684\u53c2\u6570\u3001URL Scheme\u3001\u81ea\u5b9a\u4e49\u94fe\u63a5\u7b49\u7b49\u3002\u8fd9\u91cc\u4ee5URL Scheme\u4e3a\u4f8b\u6765\u8bf4\u660e\u3002<\/p>\n

\u9996\u5148\uff0c\u5728\u9879\u76ee\u7684Info.plist\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2aURL Types\uff0c\u8bbe\u7f6eURLhbuild\u6253\u5305ios<\/a> Schemes\u4e3a\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u6807\u8bc6\u7b26\uff0c\u6bd4\u5982”myapp”\u3002<\/p>\n

\u7136\u540e\uff0c\u5728\u5e94\u7528\u4e2d\u901aios flutter \u6df7\u7f16\u6253\u5305\u542f\u52a8\u5d29\u6e83<\/a>\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u83b7\u53d6URL Scheme\uff1a<\/p>\n

“`<\/p>\n

NSString *urlScheme = [[[NSBundle mainBundle] infoDictionary] objectForKey:@”CFBundleURLTypes”][0][@”CFBundleURLSchemes”][0];<\/p>\n

“`<\/p>\n

\u6b65\u9aa4\u4e8c\uff1a\u96c6\u6210\u7edf\u8ba1\u5e93<\/p>\n

\u5728\u5e94\u7528\u4e2d\u96c6\u6210\u7edf\u8ba1\u4ee3\u7801\u53ef\u4ee5\u4f7f\u7528\u73b0\u6709\u7684\u7b2c\u4e09\u65b9\u7edf\u8ba1\u5e93\uff0c\u6bd4\u5982\u53cb\u76df\u3001\u767e\u5ea6\u79fb\u52a8\u7edf\u8ba1\u7b49\u7b49\u3002<\/p>\n

\u9996\u5148\uff0c\u4e0b\u8f7d\u7edf\u8ba1\u5e93\u7684SDK\uff0c\u5e76\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\u3002\u8fd9\u91cc\u4ee5\u53cb\u76df\u7edf\u8ba1\u4e3a\u4f8b\uff1a<\/p>\n

\u5c06\u4e0b\u8f7d\u7684\u53cb\u76dfSDK\u89e3\u538b\u540e\uff0c\u5c06UMengAnalytics.framework\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u5e76\u5c06\u5176\u76f8\u5173\u4f9d\u8d56\u5e93\u548c\u8d44\u6e90\u6587\u4ef6\u6dfb\u52a0\u5230\u9879\u76ee\u3002<\/p>\n

\u7136\u540e\uff0c\u5728\u5e94\u7528\u7684Ap<\/p>\n

<\/figure>\n<\/p>\n

pDelegate.m\u6587\u4ef6\u4e2d\u5bfc\u5165\u53cb\u76df\u7edf\u8ba1\u5e93\u5934\u6587\u4ef6\uff0c\u5e76\u5728`didFinishLaunchingWithOptions`\u65b9\u6cd5\u4e2d\u8c03\u7528\u521d\u59cb\u5316\u65b9\u6cd5\uff1a<\/p>\n

“`<\/p>\n

#import <\/p>\n

#import <\/p>\n

– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {<\/p>\n

[UMConfigure initWithAppkey:@”your_appkey” channel:@”App Store”];<\/p>\n

[MobClick setScenarioType:E_UM_NORMAL];<\/p>\n

\/\/ Other initialization code…<\/p>\n

return YES;<\/p>\n

}<\/p>\n

“`<\/p>\n

\u6b65\u9aa4\u4e09\uff1a\u53d1\u9001\u7edf\u8ba1\u6570\u636e<\/p>\n

\u5728\u5e94\u7528\u542f\u52a8\u65f6\uff0c\u83b7\u53d6\u6e20\u9053\u6807\u8bc6\u7b26\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a\u53c2\u6570\u53d1\u9001\u5230\u7edf\u8ba1\u670d\u52a1\u5668\u3002<\/p>\n

“`<\/p>\n

NSString *urlScheme = [[[NSBundle mainBundle] infoDictionary] objectForKey:@”CFBundleURLTypes”][0][@”CFBundleURLSchemes”][0];<\/p>\n

\/\/\u53d1\u9001\u7edf\u8ba1\u6570\u636e<\/p>\n

[MobClick event:@”AppInstall” attributes:@{@”channel”: urlScheme}];<\/p>\n

“`<\/p>\n

\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u4ee5”AppInstall”\u4e3a\u4e8b\u4ef6\u540d\uff0c\u5c06\u6e20\u9053\u6807\u8bc6\u7b26\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u670d\u52a1\u5668\u8fdb\u884c\u7edf\u8ba1\u3002<\/p>\n

\u6b65\u9aa4\u56db\uff1a\u7edf\u8ba1\u5206\u6790<\/p>\n

\u5728\u53cb\u76df\u540e\u53f0\u6216\u5176\u4ed6\u7edf\u8ba1\u5e73\u53f0\u7684\u63a7\u5236\u53f0\uff0c\u53ef\u4ee5\u67e5\u770b\u5e94\u7528\u7684\u6e20\u9053\u7edf\u8ba1\u6570\u636e\uff0c\u5305\u62ec\u5404\u4e2a\u6e20\u9053\u7684\u5b89\u88c5\u91cf\u3001\u6d3b\u8dc3\u7528\u6237\u3001\u7559\u5b58\u7387\u7b49\u7b49\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

iOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u662f\u901a\u8fc7\u5728\u5e94\u7528\u4e2d\u5d4c\u5165\u6e20\u9053\u6807\u8bc6\u7b26\uff0c\u5e76\u5c06\u5176\u53d1\u9001\u5230\u7edf\u8ba1\u670d\u52a1\u5668\u6765\u5b9e\u73b0\u7684\u3002\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\u83b7\u53d6\u6e20\u9053\u6807\u8bc6\u7b26\u3001\u96c6\u6210\u7edf\u8ba1\u5e93\u3001\u53d1\u9001\u7edf\u8ba1\u6570\u636e\u548c\u7edf\u8ba1\u5206\u6790\u3002\u901a\u8fc7\u6e20\u9053\u7edf\u8ba1\uff0c\u53ef\u4ee5\u4e86\u89e3\u5e94\u7528\u5728\u4e0d\u540c\u6e20\u9053\u4e0a\u7684\u8868\u73b0\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u4f18\u5316\u7b56\u7565\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

iOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u662f\u6307\u5728\u53d1\u5e03iOS\u5e94\u7528\u65f6\uff0c\u901a\u8fc7\u4e00\u79cd\u65b9\u5f0f\u5728\u5e94\u7528\u4e2d\u96c6\u6210\u7edf\u8ba1\u4ee3\u7801\uff0c\u4ee5\u4fbf\u76d1\u6d4b\u7528\u6237\u6765\u6e90\u548c\u5206\u6790\u6e20\u9053\u7684\u6548\u679c\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecdiOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u7684\u539f\u7406\u548c\u5177\u4f53\u6b65\u9aa4\u30021. \u539f\u7406\u4ecb\u7ecdiOS\u6253\u5305\u6e20\u9053\u7edf\u8ba1\u7684\u539f\u7406<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[14463,14462,2191,86,14464],"topic":[],"class_list":["post-8316","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-linuxios","tag-ue4iosapp","tag-2191","tag-86","tag-14464"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/8316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=8316"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/8316\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=8316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=8316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=8316"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=8316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}