網路追蹤
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
透過網路追蹤功能,您可以查看 Google Mobile Ads SDK 的相關網路活動,這在偵錯 Google 行動廣告導入作業時可能會很有幫助。
使用網路追蹤功能 (而非 Charles Proxy 等工具) 的主要原因是,這項功能適用於所有 iOS 版本和裝置,無須信任任何第三方安全性憑證設定檔。不過,自 iOS 10.3 版起,Proxying 工具已導入憑證設定檔規定,因此不適用上述情況。
本指南說明如何啟用網路追蹤功能,以利偵錯。
Enable tracing
如要啟用網路追蹤功能,請在 plist 檔案中將 GADEnableNetworkTracing
索引鍵設為 YES
。
啟用網路追蹤功能後,Google Mobile Ads SDK 會將網路事件記錄到控制台。接著,您可以透過開發人員論壇私人回覆,將記錄副本提供給我們的工程師進行分析。
記錄
系統會使用標準的平台專屬主控台記錄輸出網路記錄。
主控台記錄檔訊息一律會以字串 GMA Debug BEGIN
、GMA Debug CONTENT
或 GMA Debug FINISH
開頭,方便您搜尋或篩除。每個網路記錄的第一則記錄訊息為 GMA Debug BEGIN
,最後一則記錄訊息為 GMA Debug FINISH
,網路記錄內容則以 GMA Debug CONTENT
開頭。如果網路記錄內容過長,無法放在一行中,系統會將內容分割成多行,每行開頭都會加上 GMA Debug CONTENT
。
輸出內容範例
<Your App Name>[2710:30568] <Google> GMA Debug BEGIN
2017-12-06 09:47:09.268020-0800 <Your App Name>[2710:30568] <Google> GMA Debug CONTENT: {
"components" : [
"network_request_31107D12-E54E-45D6-AEA9-4A303C659EDF"
],
"timestamp" : 1512582429267.2629,
"event" : "onNetworkRequest",
"params" : {
"firstline" : {
"uri" : "<encoded text>",
"verb" : "<encoded text>"
},
"headers" : [
{
"name" : "<encoded text>",
"value" : "<encoded text>"
}
]
}
}
2017-12-06 09:47:09.275742-0800 <Your App Name>[2710:30568] <Google> GMA Debug FINISH
接著,您可以將記錄副本提供給工程師進行分析。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-02-08 (世界標準時間)。"],[[["Network tracing allows debugging of the Google Mobile Ads SDK by revealing network activities."],["It works on all iOS versions and devices without needing third-party security certificate profiles, unlike proxying tools."],["To enable, set the `GADEnableNetworkTracing` key to `YES` in your app's plist file."],["Network event logs are output to the console, starting with \"GMA Debug BEGIN\" and ending with \"GMA Debug FINISH\"."],["Share the console logs with Google engineers for analysis to help with debugging."]]],["Network tracing, used for debugging the Google Mobile Ads SDK, works on all iOS versions without needing third-party security certificates. To enable it, set `GADEnableNetworkTracing` to `YES` in your plist file. Network events are logged to the console, with messages starting with `GMA Debug BEGIN`, `GMA Debug CONTENT`, or `GMA Debug FINISH`. These logs can then be provided to engineers for analysis via the developer forum. Each network log includes content, timestamp, and event parameters.\n"]]