Dynamic-by-default method lookups for iOS development have been removed with Swift. This interrupts the agent's default method instrumentation. For example, interaction tracing in Swift classes are disabled by default, but you can re-enable them.
Interactions in a Swift app are captured if automatically instrumented classes and methods are used or when defining custom interactions. However, if a Swift class creates sub-classes for any of these default classes, follow these steps to capture interactions.
Enable dynamic method lookup
To re-enable dynamic method lookup on a method-by-method basis in Swift, adding the dynamic
declaration modifier. For example:
class MyViewController : UIViewController { override dynamic func viewDidLoad() { super.viewDidLoad() ... }}
For every function that New Relic automatically instruments, be sure to add this modifier every time you create a sub-class and override in Swift.
Enable Swift instrumentation
After adding the dynamic
keyword to your method overrides, you can re-enable Swift instrumentation by calling the following method:
Language | Procedure |
---|---|
Objective-C | Call prior to
|
Swift | Call prior to
|
その他のヘルプ
さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:
- Explorers Hubでは、コミュニティからのサポートを受けたり、ディスカッションに参加したりすることができます。
- 当社サイトで答えを見つけて、サポートポータルの使用方法を確認してください。
- Linux、Windows、およびmacOS向けトラブルシューティングツールであるNew Relic Diagnosticsを実行してください。
- New Relicの とandドキュメント をご確認ください。