<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hant-TW">
	<id>https://wiki.tamedia.com.tw/wiki/index.php?action=history&amp;feed=atom&amp;title=IOS_Beacon_SDK_Import</id>
	<title>IOS Beacon SDK Import - 修訂歷史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tamedia.com.tw/wiki/index.php?action=history&amp;feed=atom&amp;title=IOS_Beacon_SDK_Import"/>
	<link rel="alternate" type="text/html" href="https://wiki.tamedia.com.tw/wiki/index.php?title=IOS_Beacon_SDK_Import&amp;action=history"/>
	<updated>2026-05-01T19:58:57Z</updated>
	<subtitle>本 Wiki 上此頁面的修訂歷史</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.tamedia.com.tw/wiki/index.php?title=IOS_Beacon_SDK_Import&amp;diff=892&amp;oldid=prev</id>
		<title>imported&gt;Wikiuser 於 2017年7月11日 (二) 07:48</title>
		<link rel="alternate" type="text/html" href="https://wiki.tamedia.com.tw/wiki/index.php?title=IOS_Beacon_SDK_Import&amp;diff=892&amp;oldid=prev"/>
		<updated>2017-07-11T07:48:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hant-TW&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上個修訂&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;於 2017年7月11日 (二) 07:48 的修訂&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l56&quot;&gt;行 56：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;行 56：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;SDK會偵測iOS版本，如果iPhone裝置環境在iOS8以下則SDK不會進行任何運作&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;SDK會偵測iOS版本，如果iPhone裝置環境在iOS8以下則SDK不會進行任何運作&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[檔案:Beacon_import_code_4.png|none|800px]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[檔案:Beacon_import_code_4.png|none|800px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[IOS_Beacon_Ad_SDK_Tutorial|回iOS Beacon SDK教學]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Wikiuser</name></author>
	</entry>
	<entry>
		<id>https://wiki.tamedia.com.tw/wiki/index.php?title=IOS_Beacon_SDK_Import&amp;diff=891&amp;oldid=prev</id>
		<title>imported&gt;Wikiuser：新頁面: ==SDK程式碼導入== 1.在AppDelegate.m中，import BeaconNotification.h以及BeaconController.h兩個herder：     #import &quot;BeaconNotification.h&quot;     #import &quot;BeaconController.h&quot;   ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.tamedia.com.tw/wiki/index.php?title=IOS_Beacon_SDK_Import&amp;diff=891&amp;oldid=prev"/>
		<updated>2017-07-11T07:47:33Z</updated>

		<summary type="html">&lt;p&gt;新頁面: ==SDK程式碼導入== 1.在AppDelegate.m中，import BeaconNotification.h以及BeaconController.h兩個herder：     #import &amp;quot;BeaconNotification.h&amp;quot;     #import &amp;quot;BeaconController.h&amp;quot;   ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==SDK程式碼導入==&lt;br /&gt;
1.在AppDelegate.m中，import BeaconNotification.h以及BeaconController.h兩個herder：&lt;br /&gt;
    #import &amp;quot;BeaconNotification.h&amp;quot;&lt;br /&gt;
    #import &amp;quot;BeaconController.h&amp;quot;&lt;br /&gt;
     //BeaconNotification負責所有的本地推播通知的功能，因此需要導入，並搭配BeaconController進行控制。&lt;br /&gt;
2.在AppDelegate.m中，另外寫入以下的程式碼：&lt;br /&gt;
    //註冊LocationNotification的動作：(此方法在iOS 8及iOS 9皆可運作)&lt;br /&gt;
    - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler{&lt;br /&gt;
    [[BeaconNotification notificationManager] handleActionWithIdentifier:identifier forLocalNotification:notification];    &lt;br /&gt;
        //此行一定要呼叫&lt;br /&gt;
        completionHandler();&lt;br /&gt;
    }&lt;br /&gt;
    //當App在前景時，發送LocalNotification的方法：&lt;br /&gt;
    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{    &lt;br /&gt;
    [[BeaconNotification notificationManager] didReceiveBSDKNotification:notification openBtnString:[BeaconController defaultController].openBtnString closeBtnString:[BeaconController defaultController].closeBtnString delayTime:[BeaconController defaultController].closeDelayTime];&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
完成圖：[[檔案:Beacon_import_code_1.png|none|800px]]&lt;br /&gt;
3. 在App顯示首頁的ViewController.h中，import BeaconController.h &amp;lt;br/&amp;gt;   &lt;br /&gt;
BeaconController負責控制主要兩件任務，分別是偵測周圍的iBeacon, 以及控制與Server端的連線，上述2部分SDK皆會自行完成。&lt;br /&gt;
    #import &amp;quot;BeaconController.h&amp;quot;&lt;br /&gt;
4.將該ViewController採納BeaconControllerDelegate的protocol&lt;br /&gt;
    @interface ViewController : UIViewController &amp;lt;BeaconControllerDelegate&amp;gt;&lt;br /&gt;
透過採納BeaconControllerDelegate的protocol，將可以取得Callback的相關資訊。&lt;br /&gt;
完成圖：[[檔案:Beacon_import_code_2.png|none|800px]]&lt;br /&gt;
5.在ViewController.m中，在interface區塊建立BeaconController的實體&lt;br /&gt;
    @property (strong, nonatomic) BeaconController *controller;&lt;br /&gt;
6. 在ViewController.m的viewDidLoad中，寫入下方2行的程式碼(請注意在initWithSlotCode後方輸入您的Slot ID)：&lt;br /&gt;
    self.controller = [[BeaconController defaultController] initWithSlotCode:@&amp;quot;輸入您的Slot ID&amp;quot;];&lt;br /&gt;
將BeaconController的實體self.controlller透過[BeaconController defaulController]方法建立，defaultController方法將會建立一個Singleton的BeaconController的實體。&lt;br /&gt;
之後在後面加入iniitWithSlotCode，並輸入您從TAMidea取得的Slot ID，讓SDK將此參數帶入以向Server請求取得廣告欄位。&lt;br /&gt;
    self.controller.delegate = self;&lt;br /&gt;
將self.controller.delegate的代理人設定為自己。&lt;br /&gt;
完成圖：[[檔案:Beacon_import_code_3.png|none|800px]]&lt;br /&gt;
7.BeaconControllerDelegate提供數個Delegation callback方法如下：&lt;br /&gt;
方法名稱	說明&lt;br /&gt;
    - (void)BSDKdidCompleteUpdateBeaconSDK;	通知與Server連線完成並取得廣告資料&lt;br /&gt;
    - (void)BSDKdidFailUpdateBeaconSDK:(NSError *)error;	通知與Server連線失敗&lt;br /&gt;
    - (void)BSDKdidEnterBeaconRegion:(CLRegion *)region;	通知進入iBeacon區域&lt;br /&gt;
    - (void)BSDKdidExitBeaconRegion:(CLRegion *)region;	通知離開iBeacon區域&lt;br /&gt;
    - (void)BSDKdidRangeBeaconInfo:(CLBeacon*)beacon;	通知取得iBeacon裝置細部資訊&lt;br /&gt;
    -(void)BSDKdidReceivedPowerVoltage:(float)voltage fromBeacon:(NSString *)mac;	通知取得iBeacon裝置電量資訊&lt;br /&gt;
    - (void)BSDKdidReopenAdRequest;	通知廣告等待間隔期間到期，可請求廣告&lt;br /&gt;
8.錯誤訊息Error Message Log&amp;lt;br/&amp;gt;&lt;br /&gt;
表示與Server連線後，取得Server上資料失敗（可能原因：網路連線不穩定）&lt;br /&gt;
Error Domain=NSURLErrorDomain Code=-1001 &amp;quot;The request timed out.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
9. Bitcode相關&amp;lt;br/&amp;gt;&lt;br /&gt;
本SDK使用最新Xcode 7建立，因此有包含Xcode 7所提供的Bitcode機制，如打包專案時出現Bitcode相關錯誤，請至Build Setting中，搜尋Bitcode並把Enable Bitcode關閉（使用Xcode 7之專案）。&lt;br /&gt;
&lt;br /&gt;
10. 請求廣告限制&amp;lt;br/&amp;gt;&lt;br /&gt;
當廣告請求成功後，下次啟動請求廣告需滿足以下條件：&lt;br /&gt;
需等待請求廣告時間之間隔到期後，才能再次請求廣告（等待時間由Server端回傳時間值，再由SDK進行判斷）。&lt;br /&gt;
&lt;br /&gt;
11. iPhone環境在iOS8以下的情況&amp;lt;br/&amp;gt;&lt;br /&gt;
SDK會偵測iOS版本，如果iPhone裝置環境在iOS8以下則SDK不會進行任何運作&lt;br /&gt;
[[檔案:Beacon_import_code_4.png|none|800px]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Wikiuser</name></author>
	</entry>
</feed>