-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow compiling with APPLICATION_EXTENSION_API_ONLY=NO #4599
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Allow compiling with APPLICATION_EXTENSION_API_ONLY=NO ([#4599](https://github.com/getsentry/sentry-cocoa/pull/4599)) If none of the above apply, you can opt out of this check by adding |
Hey @krystofwoldrich, @brustolin 👋 |
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8c50edb | 1212.98 ms | 1233.72 ms | 20.74 ms |
c4e9093 | 1219.04 ms | 1236.00 ms | 16.96 ms |
b9a9ffd | 1201.61 ms | 1215.06 ms | 13.45 ms |
7bb0873 | 1226.18 ms | 1247.30 ms | 21.12 ms |
c50d363 | 1215.10 ms | 1231.82 ms | 16.72 ms |
dcec216 | 1238.94 ms | 1261.06 ms | 22.12 ms |
6ae86f6 | 1231.90 ms | 1255.90 ms | 24.00 ms |
e8c8a05 | 1218.71 ms | 1234.50 ms | 15.79 ms |
da5c197 | 1240.84 ms | 1247.22 ms | 6.39 ms |
89bc37d | 1240.76 ms | 1248.24 ms | 7.48 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8c50edb | 20.76 KiB | 432.31 KiB | 411.55 KiB |
c4e9093 | 21.58 KiB | 671.30 KiB | 649.72 KiB |
b9a9ffd | 21.58 KiB | 418.43 KiB | 396.85 KiB |
7bb0873 | 22.85 KiB | 407.09 KiB | 384.24 KiB |
c50d363 | 20.76 KiB | 432.68 KiB | 411.92 KiB |
dcec216 | 20.76 KiB | 432.88 KiB | 412.11 KiB |
6ae86f6 | 21.58 KiB | 625.82 KiB | 604.23 KiB |
e8c8a05 | 21.58 KiB | 683.51 KiB | 661.92 KiB |
da5c197 | 21.58 KiB | 706.97 KiB | 685.39 KiB |
89bc37d | 20.76 KiB | 401.53 KiB | 380.77 KiB |
@@ -459,7 +459,7 @@ - (void)sentrySessionEnded:(SentrySession *)session | |||
_sessionReplay = nil; | |||
} | |||
|
|||
- (void)sentrySessionStarted:(SentrySession *)session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the parameter to avoid exposing it since it was not really used in the implementation
dateProvider: dateProvider, | ||
delegate: delegate, | ||
dispatchQueue: dispatchQueueGeneric as! SentryDispatchQueueWrapper, | ||
displayLinkWrapper: displayLinkWrapperGeneric as! SentryDisplayLinkWrapper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This convenience initialiser is more of a trick to avoid exposing the SentryDispatchQueueWrapper
and SentryDisplayLinkWrapper
types since this created more complications. I will revisit this for a better solution without a forced cast if needed.
#import <Foundation/Foundation.h> | ||
|
||
@class SentryDebugMeta, SentryThread, SentryFrame; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forward declarations also didn't work in this and similar cases and were replaced with imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have discussed recently that we don’t want to expose all the classes that were made public in this PR. Do we have any alternative approach?
Thank you for your response @brustolin 🙏 |
@brustolin What was the discussion about? Was it related to If I understand the behaviour of the flag correctly after |
The discussion was not about
I dont think so. |
Yes, that make sense.
Got it, I've mixed up being in |
I just added the side effect explanation in separate PR as that information is important regardless the way forward we choose. |
It turns out there is no other way but setting swift classes public. Apple documentation says:
Somehow enabling I believe the right thing to do is to remove @objc from as many Swift classes as possible, and refactor around its usage so we only have Swift public classes that are meant to be used by the user. But this will require some work that I dont think can be solved in one PR. |
Thank you all for the feedback 🙇
This sounds like a more proper approach 👍 The list of swift files turned public with this PR may provide an initial scope for the refactoring.
Makes sense. I'm closing this PR since this we won't move forward with this approach. |
📜 Description
APPLICATION_EXTENSION_API_ONLY=NO
.I was expecting that setting
APPLICATION_EXTENSION_API_ONLY=NO
would cause no issues since it is supposed to be less restricting allowing the usage of forbidden extension API.In reality as soon as you enable
Allow app extension API only
the generated header will contain both public and internal classes (reference, reference 2). This means that disabling the flag hides many of the internal declarations that the project needs to compile.This PR exposes those classes allowing for the project to compile with
APPLICATION_EXTENSION_API_ONLY
both set toYES
andNO
.💡 Motivation and Context
Fixes #4426 and getsentry/sentry-react-native#3908
💚 How did you test it?
iOS-Swift
project on themain
branchSentry
target and setAPPLICATION_EXTENSION_API_ONLY
toNO
iOS-Swift
project withAPPLICATION_EXTENSION_API_ONLY
both set toYES
andNO
✅📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps
If this is is a viable solution:
APPLICATION_EXTENSION_API_ONLY
both set toYES
andNO