Skip to content

Commit 367cd4e

Browse files
authored
Fix warnings caused by deprecated Cocoa SDK API usages (#868)
* Remove deprecated sentry-cocoa API usages * Update changelog
1 parent 89c0614 commit 367cd4e

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Fix warnings caused by deprecated Cocoa SDK API usages ([#868](https://github.com/getsentry/sentry-unreal/pull/868))
8+
59
### Dependencies
610

711
- Bump Java SDK (Android) from v8.6.0 to v8.7.0 ([#863](https://github.com/getsentry/sentry-unreal/pull/863))

plugin-dev/Source/Sentry/Private/Apple/AppleSentrySubsystem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void FAppleSentrySubsystem::CaptureUserFeedback(TSharedPtr<ISentryUserFeedback>
243243
{
244244
TSharedPtr<SentryUserFeedbackApple> userFeedbackIOS = StaticCastSharedPtr<SentryUserFeedbackApple>(userFeedback);
245245

246-
[SENTRY_APPLE_CLASS(SentrySDK) captureUserFeedback:userFeedbackIOS->GetNativeObject()];
246+
[SENTRY_APPLE_CLASS(SentrySDK) captureFeedback:userFeedbackIOS->GetNativeObject()];
247247
}
248248

249249
void FAppleSentrySubsystem::SetUser(TSharedPtr<ISentryUser> user)
@@ -363,7 +363,9 @@ TSharedPtr<ISentryTransactionContext> FAppleSentrySubsystem::ContinueTrace(const
363363
traceId:traceId
364364
spanId:[[SENTRY_APPLE_CLASS(SentrySpanId) alloc] init]
365365
parentSpanId:[[SENTRY_APPLE_CLASS(SentrySpanId) alloc] initWithValue:traceParts[1].GetNSString()]
366-
parentSampled:sampleDecision];
366+
parentSampled:sampleDecision
367+
parentSampleRate:nil
368+
parentSampleRand:nil];
367369

368370
// currently `sentry-cocoa` doesn't have API for `SentryTransactionContext` to set `baggageHeaders`
369371

plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@ SentryUserFeedbackApple::SentryUserFeedbackApple(TSharedPtr<ISentryId> eventId)
1111
{
1212
TSharedPtr<SentryIdApple> idIOS = StaticCastSharedPtr<SentryIdApple>(eventId);
1313
SentryId* id = idIOS->GetNativeObject();
14-
UserFeedbackApple = [[SENTRY_APPLE_CLASS(SentryUserFeedback) alloc] initWithEventId:id];
14+
15+
// `SentryFeedback` is defined in Swift so its name that can be recognized by UE should be taken from "Sentry-Swift.h" to successfully load class on Mac
16+
#if PLATFORM_MAC
17+
UserFeedbackApple = [[SENTRY_APPLE_CLASS(_TtC6Sentry14SentryFeedback) alloc] initWithMessage:@""
18+
name:nil email:nil source:SentryFeedbackSourceCustom associatedEventId:id attachments:nil];
19+
#elif PLATFORM_IOS
20+
UserFeedbackApple = [[SENTRY_APPLE_CLASS(SentryFeedback) alloc] initWithMessage:@""
21+
name:nil email:nil source:SentryFeedbackSourceCustom associatedEventId:id attachments:nil];
22+
#endif
1523
}
1624

1725
SentryUserFeedbackApple::~SentryUserFeedbackApple()
1826
{
1927
// Put custom destructor logic here if needed
2028
}
2129

22-
SentryUserFeedback* SentryUserFeedbackApple::GetNativeObject()
30+
SentryFeedback* SentryUserFeedbackApple::GetNativeObject()
2331
{
2432
return UserFeedbackApple;
2533
}
@@ -46,10 +54,10 @@ FString SentryUserFeedbackApple::GetEmail() const
4654

4755
void SentryUserFeedbackApple::SetComment(const FString& comment)
4856
{
49-
UserFeedbackApple.comments = comment.GetNSString();
57+
UserFeedbackApple.message = comment.GetNSString();
5058
}
5159

5260
FString SentryUserFeedbackApple::GetComment() const
5361
{
54-
return FString(UserFeedbackApple.comments);
62+
return FString(UserFeedbackApple.message);
5563
}

plugin-dev/Source/Sentry/Private/Apple/SentryUserFeedbackApple.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
class ISentryId;
88

9-
@class SentryUserFeedback;
9+
@class SentryFeedback;
1010

1111
class SentryUserFeedbackApple : public ISentryUserFeedback
1212
{
1313
public:
1414
SentryUserFeedbackApple(TSharedPtr<ISentryId> eventId);
1515
virtual ~SentryUserFeedbackApple() override;
1616

17-
SentryUserFeedback* GetNativeObject();
17+
SentryFeedback* GetNativeObject();
1818

1919
virtual void SetName(const FString& name) override;
2020
virtual FString GetName() const override;
@@ -24,5 +24,5 @@ class SentryUserFeedbackApple : public ISentryUserFeedback
2424
virtual FString GetComment() const override;
2525

2626
private:
27-
SentryUserFeedback* UserFeedbackApple;
27+
SentryFeedback* UserFeedbackApple;
2828
};

0 commit comments

Comments
 (0)