Skip to content

Commit

Permalink
Merge branch 'develop' into log-reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
cdillard-NewRelic authored Jan 30, 2024
2 parents 8d1cb61 + b22af29 commit 016aad2
Show file tree
Hide file tree
Showing 45 changed files with 3,323 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CMakeFiles/
Makefile
Testing/
build/
examples/cocoapods/CocoapodsExample/Pods/

# idea project files
# Xcode
Expand Down Expand Up @@ -87,4 +88,3 @@ fastlane/test_output

iOSInjectionProject/
.DS_Store

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// AppDelegate.swift
// NRTestApp
//
// Created by Mike Bruin on 1/11/23.
//

import UIKit
import NewRelic

// For more info on installing the New Relic agent go to https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/installation/spm-installation/#configure-using-swift-package-manager

class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if DEBUG
// The New Relic agent is set to log at NRLogLevelInfo by default, verbose logging should only be used for debugging.
NRLogger.setLogLevels(NRLogLevelVerbose.rawValue)
#endif

NewRelic.start(withApplicationToken:"APP-TOKEN")

return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// CocoapodsExampleApp.swift
// CocoapodsExample
//
// Created by Chris Dillard on 9/20/23.
//

import SwiftUI

@main
struct CocoapodsExampleApp: App {

@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ContentView.swift
// CocoapodsExample
//
// Created by Chris Dillard on 9/20/23.
//

import SwiftUI
import NewRelic

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
Text("Hello, world!")

Button {
crash()
} label: {
Text("Test crash")
}
}
.padding()
}

func crash() {
// This will cause a crash to test the crash uploader, crash files will not get recorded if the debugger is running.
NewRelic.crashNow("New Relic intentionally crashed to test Utils")
}
}

#Preview {
ContentView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions examples/cocoapods/CocoapodsExample/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'CocoapodsExample' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for CocoapodsExample

pod 'NewRelicAgent'

end
16 changes: 16 additions & 0 deletions examples/cocoapods/CocoapodsExample/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- NewRelicAgent (7.4.8)

DEPENDENCIES:
- NewRelicAgent

SPEC REPOS:
trunk:
- NewRelicAgent

SPEC CHECKSUMS:
NewRelicAgent: 87553984bd86ff4d0e1ae213ef4bade772c86c0a

PODFILE CHECKSUM: a12233dda4cc53061de03554f08862e636e26a89

COCOAPODS: 1.14.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# 2022 New Relic
# Shell wrapper script used to upload a builds debug symbols to New Relic.
# run-symbol-tool

if [ ! $1 ]; then
echo "New Relic: usage: $0 <NEW_RELIC_APP_TOKEN> [--debug]"
exit -1
fi

API_KEY=$1
DEBUG_FLAG=${2:-''}

echo "New Relic: Processing dSYMs and uploading to New Relic. (In background...)"
echo "New Relic: For troubleshooting, see upload_dsym_results.log file in project root folder. Add --debug after app token in Run Script for additional information."

WORK_DIRECTORY=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SCRIPT="$WORK_DIRECTORY/run-symbol-tool.swift"

## Running with below command is useful for seeing output in Xcode,
## but it will incur delays in the build process while the dSYMs process and upload.
# /usr/bin/xcrun --sdk macosx swift "$SCRIPT" $API_KEY $DEBUG_FLAG

/usr/bin/xcrun --sdk macosx swift "$SCRIPT" $API_KEY $DEBUG_FLAG > upload_dsym_results.log 2>&1 &
Loading

0 comments on commit 016aad2

Please sign in to comment.