title |
---|
iOS Simulator 101 |
Table of Contents
[TOC]
Code injection allows you to update the implementation of functions and any method of a class, struct or enum incrementally in the iOS simulator without having to rebuild or restart your application.
#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#endif
-
using default method.
@objc func injected() { // injection method }
-
using notification:
INJECTION_BUNDLE_NOTIFICATION
(this is notification name)
-Xlinker -interposable
Just look into this document
Just record mac Screen!
Right click
QuickTime
app in Dock andRecord
.Stop in top menu bar right corner.
xcrun simctl io booted recordVideo videoName.mov
Just ctrl
+ c
xcrun simctl list | grep Booted
# 40F9EEBF-98BE-4203-99BB-C64D95E4D7A4 is your deivce ID
xcrun simctl push 40F9EEBF-98BE-4203-99BB-C64D95E4D7A4 com.bundle.identifier PushNotificationPayload.apns
PushNotificationPayload.apns
is a Notification Simulation File(JSON payload). You can create it in watchOS Resource
com.bundle.identifier
is needed to replace with your app bundle identifier. Or
-
remove it from command line.
-
Add
"Simulator Target Bundle": "com.bundle.identifier",
intoNotification Simulation File(JSON payload)
on the top level.{ "Simulator Target Bundle": "com.bundle.identifier", "aps": { "alert": { "body": "Test message", "title": "Optional title", "subtitle": "Optional subtitle" }, "category": "myCategory", "thread-id": "5280" }, "customKey": "" }
Notification Simulation File(JSON payload)
should be had this key-value "Simulator Target Bundle": "com.bundle.identifier",
on the top level.