Skip to content

Commit

Permalink
[PLAT-5789] Fix property declaration warnings (#985)
Browse files Browse the repository at this point in the history
* Add an empty non-ARC file to expose warnings

* Fix property declaration warnings and use copy for strings

* Fix missing whitespace after property attributes

* No need to use copy attribute for NSNumber

* BugsnagStackframeType is a string; so use copy

* Add #985 to changelog
  • Loading branch information
nickdowell authored Jan 29, 2021
1 parent b57ddaa commit eceded7
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 64 deletions.
10 changes: 10 additions & 0 deletions Bugsnag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@
01468F5625876DC1002B0519 /* BSGNotificationBreadcrumbs.m in Sources */ = {isa = PBXBuildFile; fileRef = 01468F5125876DC1002B0519 /* BSGNotificationBreadcrumbs.m */; };
01468F5725876DC1002B0519 /* BSGNotificationBreadcrumbs.m in Sources */ = {isa = PBXBuildFile; fileRef = 01468F5125876DC1002B0519 /* BSGNotificationBreadcrumbs.m */; };
01468F5825876DC1002B0519 /* BSGNotificationBreadcrumbs.m in Sources */ = {isa = PBXBuildFile; fileRef = 01468F5125876DC1002B0519 /* BSGNotificationBreadcrumbs.m */; };
015F528425C15BB7000D1915 /* MRCCanary.m in Sources */ = {isa = PBXBuildFile; fileRef = 015F528325C15BB7000D1915 /* MRCCanary.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
015F528525C15BB7000D1915 /* MRCCanary.m in Sources */ = {isa = PBXBuildFile; fileRef = 015F528325C15BB7000D1915 /* MRCCanary.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
015F528625C15BB7000D1915 /* MRCCanary.m in Sources */ = {isa = PBXBuildFile; fileRef = 015F528325C15BB7000D1915 /* MRCCanary.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
015F528725C15BB7000D1915 /* MRCCanary.m in Sources */ = {isa = PBXBuildFile; fileRef = 015F528325C15BB7000D1915 /* MRCCanary.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
0163BF5925823D8D008DC28B /* NotificationBreadcrumbTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0163BF5825823D8D008DC28B /* NotificationBreadcrumbTests.m */; };
0163BF5A25823D8D008DC28B /* NotificationBreadcrumbTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0163BF5825823D8D008DC28B /* NotificationBreadcrumbTests.m */; };
0163BF5B25823D8D008DC28B /* NotificationBreadcrumbTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0163BF5825823D8D008DC28B /* NotificationBreadcrumbTests.m */; };
Expand Down Expand Up @@ -1277,6 +1281,7 @@
0140D24725765F8F00FD0306 /* BSGUIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGUIKit.h; sourceTree = "<group>"; };
01468F5025876DC1002B0519 /* BSGNotificationBreadcrumbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSGNotificationBreadcrumbs.h; sourceTree = "<group>"; };
01468F5125876DC1002B0519 /* BSGNotificationBreadcrumbs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSGNotificationBreadcrumbs.m; sourceTree = "<group>"; };
015F528325C15BB7000D1915 /* MRCCanary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRCCanary.m; sourceTree = "<group>"; };
0163BF5825823D8D008DC28B /* NotificationBreadcrumbTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationBreadcrumbTests.m; sourceTree = "<group>"; };
016875C4258D003200DFFF69 /* NSUserDefaultsStub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSUserDefaultsStub.h; sourceTree = "<group>"; };
016875C5258D003200DFFF69 /* NSUserDefaultsStub.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSUserDefaultsStub.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1789,6 +1794,7 @@
CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */,
008968142486DA5600DC48C2 /* BugsnagLogger.h */,
008968122486DA5600DC48C2 /* BugsnagPlatformConditional.h */,
015F528325C15BB7000D1915 /* MRCCanary.m */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -2546,6 +2552,7 @@
0089695D2486DAD000DC48C2 /* BSG_KSMach_x86_32.c in Sources */,
00896A1A2486DAD100DC48C2 /* BSG_KSCrashSentry_MachException.c in Sources */,
008968F02486DAB800DC48C2 /* BugsnagFileStore.m in Sources */,
015F528425C15BB7000D1915 /* MRCCanary.m in Sources */,
008969AE2486DAD100DC48C2 /* NSError+BSG_SimpleConstructor.m in Sources */,
008968CB2486DA9600DC48C2 /* BugsnagThread.m in Sources */,
008968022486DA4500DC48C2 /* BSGConnectivity.m in Sources */,
Expand Down Expand Up @@ -2711,6 +2718,7 @@
0089695E2486DAD000DC48C2 /* BSG_KSMach_x86_32.c in Sources */,
00896A1B2486DAD100DC48C2 /* BSG_KSCrashSentry_MachException.c in Sources */,
008968F12486DAB800DC48C2 /* BugsnagFileStore.m in Sources */,
015F528525C15BB7000D1915 /* MRCCanary.m in Sources */,
008969AF2486DAD100DC48C2 /* NSError+BSG_SimpleConstructor.m in Sources */,
008968CC2486DA9600DC48C2 /* BugsnagThread.m in Sources */,
008968032486DA4500DC48C2 /* BSGConnectivity.m in Sources */,
Expand Down Expand Up @@ -2874,6 +2882,7 @@
0089695F2486DAD000DC48C2 /* BSG_KSMach_x86_32.c in Sources */,
00896A1C2486DAD100DC48C2 /* BSG_KSCrashSentry_MachException.c in Sources */,
008968F22486DAB800DC48C2 /* BugsnagFileStore.m in Sources */,
015F528625C15BB7000D1915 /* MRCCanary.m in Sources */,
008969B02486DAD100DC48C2 /* NSError+BSG_SimpleConstructor.m in Sources */,
008968CD2486DA9600DC48C2 /* BugsnagThread.m in Sources */,
008968042486DA4500DC48C2 /* BSGConnectivity.m in Sources */,
Expand Down Expand Up @@ -3036,6 +3045,7 @@
CBE9063025A34DAB0045B965 /* BSGStorageMigratorV0V1.m in Sources */,
0089683D2486DA6C00DC48C2 /* BugsnagMetadata.m in Sources */,
0089682E2486DA5600DC48C2 /* BSGSerialization.m in Sources */,
015F528725C15BB7000D1915 /* MRCCanary.m in Sources */,
008968A02486DA9600DC48C2 /* BugsnagSessionTrackingPayload.m in Sources */,
0089686E2486DA9500DC48C2 /* BugsnagEvent.m in Sources */,
008967EB2486DA2D00DC48C2 /* BugsnagErrorTypes.m in Sources */,
Expand Down
12 changes: 12 additions & 0 deletions Bugsnag/Helpers/MRCCanary.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// MRCCanary.m
// Bugsnag
//
// Created by Nick Dowell on 27/01/2021.
// Copyright © 2021 Bugsnag Inc. All rights reserved.
//

//
// This file is compiled with ARC disabled to expose any build warnings that may arise in the public headers.
//
#import <Bugsnag/Bugsnag.h>
14 changes: 7 additions & 7 deletions Bugsnag/include/Bugsnag/BugsnagApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,36 @@
/**
* The bundle version used by the application
*/
@property(nonatomic) NSString *_Nullable bundleVersion;
@property (copy, nullable, nonatomic) NSString *bundleVersion;

/**
* The revision ID from the manifest (React Native apps only)
*/
@property(nonatomic) NSString *_Nullable codeBundleId;
@property (copy, nullable, nonatomic) NSString *codeBundleId;

/**
* Unique identifier for the debug symbols file corresponding to the application
*/
@property(nonatomic) NSString *_Nullable dsymUuid;
@property (copy, nullable, nonatomic) NSString *dsymUuid;

/**
* The app identifier used by the application
*/
@property(nonatomic) NSString *_Nullable id;
@property (copy, nullable, nonatomic) NSString *id;

/**
* The release stage set in Configuration
*/
@property(nonatomic) NSString *_Nullable releaseStage;
@property (copy, nullable, nonatomic) NSString *releaseStage;

/**
* The application type set in Configuration
*/
@property(nonatomic) NSString *_Nullable type;
@property (copy, nullable, nonatomic) NSString *type;

/**
* The version of the application set in Configuration
*/
@property(nonatomic) NSString *_Nullable version;
@property (copy, nullable, nonatomic) NSString *version;

@end
6 changes: 3 additions & 3 deletions Bugsnag/include/Bugsnag/BugsnagAppWithState.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
/**
* The number of milliseconds the application was running before the event occurred
*/
@property(nonatomic, nullable) NSNumber *duration;
@property (strong, nullable, nonatomic) NSNumber *duration;

/**
* The number of milliseconds the application was running in the foreground before the
* event occurred
*/
@property(nonatomic, nullable) NSNumber *durationInForeground;
@property (strong, nullable, nonatomic) NSNumber *durationInForeground;

/**
* Whether the application was in the foreground when the event occurred
*/
@property(nonatomic) BOOL inForeground;
@property (nonatomic) BOOL inForeground;

@end
2 changes: 1 addition & 1 deletion Bugsnag/include/Bugsnag/BugsnagClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ NS_SWIFT_NAME(leaveBreadcrumb(_:metadata:type:));
/**
* Retrieves the context - a general summary of what was happening in the application
*/
@property NSString *_Nullable context;
@property (copy, nullable) NSString *context;

/**
* @return YES if Bugsnag has been started and the previous launch crashed
Expand Down
22 changes: 11 additions & 11 deletions Bugsnag/include/Bugsnag/BugsnagConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
/**
* The API key of a Bugsnag project
*/
@property(readwrite, retain, nonnull) NSString *apiKey;
@property (copy, nonatomic) NSString *apiKey;

/**
* The release stage of the application, such as production, development, beta
* et cetera
*/
@property(readwrite, retain, nullable) NSString *releaseStage;
@property (copy, nullable, nonatomic) NSString *releaseStage;

/**
* Release stages which are allowed to notify Bugsnag
*/
@property(readwrite, retain, nullable) NSSet<NSString *> *enabledReleaseStages;
@property (copy, nullable, nonatomic) NSSet<NSString *> *enabledReleaseStages;

/**
* Sets which values should be removed from any Metadata objects before
Expand All @@ -150,7 +150,7 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
* By default, redactedKeys is set to ["password"]. Both string literals and regex
* values can be supplied to this property.
*/
@property(readwrite, retain, nullable) NSSet<id> *redactedKeys;
@property (copy, nullable, nonatomic) NSSet<id> *redactedKeys;

/**
* A set of strings and / or NSRegularExpression objects that determine which errors should
Expand All @@ -164,17 +164,17 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
* signal names like "SIGABRT", mach exception names like "EXC_BREAKPOINT", and Swift
* error names like "Fatal error".
*/
@property(readwrite, copy, nullable) NSSet<id> *discardClasses;
@property (copy, nullable, nonatomic) NSSet<id> *discardClasses;

/**
* A general summary of what was occuring in the application
*/
@property(readwrite, retain, nullable) NSString *context;
@property (copy, nullable, nonatomic) NSString *context;

/**
* The version of the application
*/
@property(readwrite, retain, nullable) NSString *appVersion;
@property (copy, nullable, nonatomic) NSString *appVersion;

/**
* The URL session used to send requests to Bugsnag.
Expand Down Expand Up @@ -217,9 +217,9 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
/**
* The app's bundleVersion, set from the CFBundleVersion. Equivalent to `versionCode` on Android.
*/
@property (readwrite, retain, nullable) NSString *bundleVersion;
@property (copy, nullable, nonatomic) NSString *bundleVersion;

@property(retain, nullable) NSString *appType;
@property (copy, nullable, nonatomic) NSString *appType;

/**
* Sets the maximum number of events which will be stored. Once the threshold is reached,
Expand Down Expand Up @@ -259,7 +259,7 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
* A class defining the types of error that are reported. By default,
* all properties are true.
*/
@property BugsnagErrorTypes *_Nonnull enabledErrorTypes;
@property (strong, nonatomic) BugsnagErrorTypes *enabledErrorTypes;

/**
* Set the endpoints to send data to. By default we'll send error reports to
Expand All @@ -270,7 +270,7 @@ typedef BOOL (^BugsnagOnSessionBlock)(BugsnagSession *_Nonnull session);
* missing, an assertion will be thrown. If the session endpoint is missing, a warning will be
* logged and sessions will not be sent automatically.
*/
@property(nonnull, nonatomic) BugsnagEndpointConfiguration *endpoints;
@property (strong, nonatomic) BugsnagEndpointConfiguration *endpoints;

// =============================================================================
// MARK: - User
Expand Down
20 changes: 10 additions & 10 deletions Bugsnag/include/Bugsnag/BugsnagDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,52 @@
/**
* Whether the device has been jailbroken
*/
@property(nonatomic) BOOL jailbroken;
@property (nonatomic) BOOL jailbroken;

/**
* A unique ID generated by Bugsnag which identifies the device
*/
@property(nonatomic, nullable) NSString *id;
@property (copy, nullable, nonatomic) NSString *id;

/**
* The IETF language tag of the locale used
*/
@property(nonatomic, nullable) NSString *locale;
@property (copy, nullable, nonatomic) NSString *locale;

/**
* The manufacturer of the device used
*/
@property(nonatomic, nullable) NSString *manufacturer;
@property (copy, nullable, nonatomic) NSString *manufacturer;

/**
* The model name of the device used
*/
@property(nonatomic, nullable) NSString *model;
@property (copy, nullable, nonatomic) NSString *model;

/**
* The model number of the device used
*/
@property(nonatomic, nullable) NSString *modelNumber;
@property (copy, nullable, nonatomic) NSString *modelNumber;

/**
* The name of the operating system running on the device used
*/
@property(nonatomic, nullable) NSString *osName;
@property (copy, nullable, nonatomic) NSString *osName;

/**
* The version of the operating system running on the device used
*/
@property(nonatomic, nullable) NSString *osVersion;
@property (copy, nullable, nonatomic) NSString *osVersion;

/**
* A collection of names and their versions of the primary languages, frameworks or
* runtimes that the application is running on
*/
@property(nonatomic, nullable) NSDictionary<NSString *, NSString *> *runtimeVersions;
@property (copy, nullable, nonatomic) NSDictionary<NSString *, NSString *> *runtimeVersions;

/**
* The total number of bytes of memory on the device
*/
@property(nonatomic, nullable) NSNumber *totalMemory;
@property (strong, nullable, nonatomic) NSNumber *totalMemory;

@end
8 changes: 4 additions & 4 deletions Bugsnag/include/Bugsnag/BugsnagDeviceWithState.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
/**
* The number of free bytes of storage available on the device
*/
@property(nonatomic, nullable) NSNumber *freeDisk;
@property (strong, nullable, nonatomic) NSNumber *freeDisk;

/**
* The number of free bytes of memory available on the device
*/
@property(nonatomic, nullable) NSNumber *freeMemory;
@property (strong, nullable, nonatomic) NSNumber *freeMemory;

/**
* The orientation of the device when the event occurred
*/
@property(nonatomic, nullable) NSString *orientation;
@property (copy, nullable, nonatomic) NSString *orientation;

/**
* The timestamp on the device when the event occurred
*/
@property(nonatomic, nullable) NSDate *time;
@property (strong, nullable, nonatomic) NSDate *time;

@end
4 changes: 2 additions & 2 deletions Bugsnag/include/Bugsnag/BugsnagEndpointConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Configures the endpoint to which events should be sent
*/
@property NSString *notify;
@property (copy, nonatomic) NSString *notify;

/**
* Configures the endpoint to which sessions should be sent
*/
@property NSString *sessions;
@property (copy, nonatomic) NSString *sessions;

- (instancetype)initWithNotify:(NSString *)notify
sessions:(NSString *)sessions;
Expand Down
6 changes: 3 additions & 3 deletions Bugsnag/include/Bugsnag/BugsnagError.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ typedef NS_OPTIONS(NSUInteger, BSGErrorType) {
/**
* The class of the error generating the report
*/
@property(nullable) NSString *errorClass;
@property (copy, nullable, nonatomic) NSString *errorClass;

/**
* The message of or reason for the error generating the report
*/
@property(nullable) NSString *errorMessage;
@property (copy, nullable, nonatomic) NSString *errorMessage;

/**
* Sets a representation of this error's stacktrace
*/
@property(nonnull) NSArray<BugsnagStackframe *> *stacktrace;
@property (copy, nonnull, nonatomic) NSArray<BugsnagStackframe *> *stacktrace;

/**
* The type of the captured error
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/include/Bugsnag/BugsnagEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ typedef NS_ENUM(NSUInteger, BSGSeverity) {
* Bugsnag dashboard. Use event.errors to access and amend the representation of
* the error that will be sent.
*/
@property(nullable) id originalError;
@property(strong, nullable, nonatomic) id originalError;


// =============================================================================
Expand Down
19 changes: 12 additions & 7 deletions Bugsnag/include/Bugsnag/BugsnagSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@
#import <Bugsnag/BugsnagDevice.h>
#import <Bugsnag/BugsnagUser.h>

NS_ASSUME_NONNULL_BEGIN

/**
* Represents a session of user interaction with your app.
*/
@interface BugsnagSession : NSObject

@property NSString *_Nonnull id;
@property NSDate *_Nonnull startedAt;
@property(readonly) BugsnagApp *_Nonnull app;
@property(readonly) BugsnagDevice *_Nonnull device;
@property (copy, nonatomic) NSString *id;

@property (strong, nonatomic) NSDate *startedAt;

@property (readonly, nonatomic) BugsnagApp *app;

@property (readonly, nonatomic) BugsnagDevice *device;

// =============================================================================
// MARK: - User
Expand All @@ -38,8 +43,8 @@
* @param name Name of the user
* @param email Email address of the user
*/
- (void)setUser:(NSString *_Nullable)userId
withEmail:(NSString *_Nullable)email
andName:(NSString *_Nullable)name;
- (void)setUser:(nullable NSString *)userId withEmail:(nullable NSString *)email andName:(nullable NSString *)name;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit eceded7

Please sign in to comment.