From 96a8e0b5f1f8e57a4cf07e917dc6f41eff905e3f Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 12 Oct 2015 12:15:33 -0700 Subject: [PATCH] Fix all new warnings. --- .../URLSession/Session/PFURLSession.m | 14 ++++++------ .../Controller/PFInstallationController.m | 22 ++++++++++--------- .../PFCurrentInstallationController.m | 4 +++- .../OfflineStore/PFOfflineStore.m | 20 ++++++++--------- .../LocalDataStore/SQLite/PFSQLiteDatabase.m | 10 ++++----- .../Object/OperationSet/PFOperationSet.m | 8 +++---- Parse/Internal/PFEventuallyPin.m | 14 ++++++------ Parse/Internal/PFInternalUtils.m | 12 +++++----- Parse/Internal/PFKeychainStore.m | 4 +++- Parse/Internal/PFLogger.m | 5 +++-- Parse/Internal/PFMulticastDelegate.h | 5 +---- Parse/Internal/PFMulticastDelegate.m | 22 +++++++++++++------ Parse/Internal/PFPinningEventuallyQueue.m | 7 +++--- .../PFPaymentTransactionObserver.m | 17 ++++++++------ .../Controller/PFOfflineQueryController.m | 2 +- Parse/Internal/Query/PFQueryPrivate.h | 6 +---- .../Query/Utilities/PFQueryUtilities.m | 2 +- .../User/Controller/PFUserController.m | 4 ++-- .../PFCurrentUserController.m | 5 +++-- Parse/PFConfig.m | 1 + Parse/PFFile.h | 2 +- Parse/PFGeoPoint.m | 1 + Parse/PFObject.h | 2 +- Parse/PFQuery.h | 4 ++-- Parse/PFQuery.m | 3 +++ Parse/PFRelation.m | 6 ++--- Parse/PFUser.h | 2 +- Tests/Other/TestCases/TestCase/PFTestCase.m | 2 +- 28 files changed, 113 insertions(+), 93 deletions(-) diff --git a/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m b/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m index 9934f475d..6c7a03f6b 100644 --- a/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m +++ b/Parse/Internal/Commands/CommandRunner/URLSession/Session/PFURLSession.m @@ -195,7 +195,7 @@ - (BFTask *)_performDataTask:(NSURLSessionDataTask *)dataTask withDelegate:(PFUR #pragma mark - Private ///-------------------------------------- -- (PFURLSessionDataTaskDelegate *)_taskDelegateForDataTask:(NSURLSessionDataTask *)task { +- (PFURLSessionDataTaskDelegate *)_taskDelegateForTask:(NSURLSessionTask *)task { __block PFURLSessionDataTaskDelegate *delegate = nil; dispatch_sync(_delegatesAccessQueue, ^{ delegate = _delegatesDictionary[@(task.taskIdentifier)]; @@ -220,11 +220,11 @@ - (void)_removeDelegateForTaskWithIdentifier:(NSNumber *)identifier { ///-------------------------------------- - (void)URLSession:(NSURLSession *)session - task:(NSURLSessionDataTask *)task + task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend { - PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForDataTask:task]; + PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForTask:task]; [delegate URLSession:session task:task didSendBodyData:bytesSent @@ -232,8 +232,8 @@ - (void)URLSession:(NSURLSession *)session totalBytesExpectedToSend:totalBytesExpectedToSend]; } -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionDataTask *)task didCompleteWithError:(NSError *)error { - PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForDataTask:task]; +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForTask:task]; [delegate URLSession:session task:task didCompleteWithError:error]; } @@ -245,12 +245,12 @@ - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { - PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForDataTask:dataTask]; + PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForTask:dataTask]; [delegate URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler]; } - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { - PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForDataTask:dataTask]; + PFURLSessionDataTaskDelegate *delegate = [self _taskDelegateForTask:dataTask]; [delegate URLSession:session dataTask:dataTask didReceiveData:data]; } diff --git a/Parse/Internal/Installation/Controller/PFInstallationController.m b/Parse/Internal/Installation/Controller/PFInstallationController.m index 66d09cc63..c656d1279 100644 --- a/Parse/Internal/Installation/Controller/PFInstallationController.m +++ b/Parse/Internal/Installation/Controller/PFInstallationController.m @@ -39,9 +39,10 @@ + (instancetype)controllerWithDataSource:(id)command }]; break; } - case PFEventuallyPinTypeDelete: { task = [task continueWithBlock:^id(BFTask *task) { PFObject *object = eventuallyPin.object; @@ -245,8 +245,9 @@ - (BFTask *)_didFinishRunningCommand:(id)command }]; break; } - - default:break; + case PFEventuallyPinTypeCommand: + default: + break; } return task; diff --git a/Parse/Internal/Purchase/PaymentTransactionObserver/PFPaymentTransactionObserver.m b/Parse/Internal/Purchase/PaymentTransactionObserver/PFPaymentTransactionObserver.m index 100750de9..9ecffc09e 100644 --- a/Parse/Internal/Purchase/PaymentTransactionObserver/PFPaymentTransactionObserver.m +++ b/Parse/Internal/Purchase/PaymentTransactionObserver/PFPaymentTransactionObserver.m @@ -23,12 +23,14 @@ @implementation PFPaymentTransactionObserver ///-------------------------------------- - (instancetype)init { - if (self = [super init]) { - blocks = [[NSMutableDictionary alloc] init]; - runOnceBlocks = [[NSMutableDictionary alloc] init]; - lockObj = [[NSObject alloc] init]; - runOnceLockObj = [[NSObject alloc] init]; - } + self = [super init]; + if (!self) return nil; + + blocks = [[NSMutableDictionary alloc] init]; + runOnceBlocks = [[NSMutableDictionary alloc] init]; + lockObj = [[NSObject alloc] init]; + runOnceLockObj = [[NSObject alloc] init]; + return self; } @@ -44,7 +46,8 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran case SKPaymentTransactionStateRestored: [self completeTransaction:transaction fromPaymentQueue:queue]; break; - default: + case SKPaymentTransactionStatePurchasing: + case SKPaymentTransactionStateDeferred: break; } } diff --git a/Parse/Internal/Query/Controller/PFOfflineQueryController.m b/Parse/Internal/Query/Controller/PFOfflineQueryController.m index edca5d55e..6ba12c41d 100644 --- a/Parse/Internal/Query/Controller/PFOfflineQueryController.m +++ b/Parse/Internal/Query/Controller/PFOfflineQueryController.m @@ -34,7 +34,7 @@ @implementation PFOfflineQueryController #pragma mark - Init ///-------------------------------------- -- (instancetype)initWithCommonDataSource:(id)dataSource { +- (instancetype)initWithCommonDataSource:(id)dataSource { PFNotDesignatedInitializer(); } diff --git a/Parse/Internal/Query/PFQueryPrivate.h b/Parse/Internal/Query/PFQueryPrivate.h index 149386e95..4c90e39cb 100644 --- a/Parse/Internal/Query/PFQueryPrivate.h +++ b/Parse/Internal/Query/PFQueryPrivate.h @@ -42,14 +42,10 @@ extern NSString *const PFQueryOptionKeyRegexOptions; @class BFTask PF_GENERIC(__covariant BFGenericType); @class PFObject; -@interface PFQuery () +@interface PFQuery (Private) @property (nonatomic, strong, readonly) PFQueryState *state; -@end - -@interface PFQuery (Private) - - (instancetype)whereRelatedToObject:(PFObject *)parent fromKey:(NSString *)key; - (void)redirectClassNameForKey:(NSString *)key; diff --git a/Parse/Internal/Query/Utilities/PFQueryUtilities.m b/Parse/Internal/Query/Utilities/PFQueryUtilities.m index 5e9b7172d..d97d589fa 100644 --- a/Parse/Internal/Query/Utilities/PFQueryUtilities.m +++ b/Parse/Internal/Query/Utilities/PFQueryUtilities.m @@ -96,7 +96,7 @@ + (NSPredicate *)_negatePredicate:(NSPredicate *)predicate { } comparisonBlock:^NSPredicate *(NSComparisonPredicate *comparison) { NSPredicateOperatorType newType; NSComparisonPredicateModifier newModifier = comparison.comparisonPredicateModifier; - SEL customSelector; + SEL customSelector = NULL; switch (comparison.predicateOperatorType) { case NSEqualToPredicateOperatorType: { diff --git a/Parse/Internal/User/Controller/PFUserController.m b/Parse/Internal/User/Controller/PFUserController.m index cebeb52f4..43bfd7db3 100644 --- a/Parse/Internal/User/Controller/PFUserController.m +++ b/Parse/Internal/User/Controller/PFUserController.m @@ -26,7 +26,7 @@ @implementation PFUserController ///-------------------------------------- - (instancetype)initWithCommonDataSource:(id)commonDataSource - coreDataSource:(id)coreDataSource { + coreDataSource:(id)coreDataSource { self = [super init]; if (!self) return nil; @@ -37,7 +37,7 @@ - (instancetype)initWithCommonDataSource:(id)commonData } + (instancetype)controllerWithCommonDataSource:(id)commonDataSource - coreDataSource:(id)coreDataSource { + coreDataSource:(id)coreDataSource { return [[self alloc] initWithCommonDataSource:commonDataSource coreDataSource:coreDataSource]; } diff --git a/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m b/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m index 098b4e61f..82d251e5f 100644 --- a/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m +++ b/Parse/Internal/User/CurrentUserController/PFCurrentUserController.m @@ -82,9 +82,10 @@ - (BFTask *)getCurrentObjectAsync { return [self getCurrentUserAsyncWithOptions:options]; } -- (BFTask *)saveCurrentObjectAsync:(PFUser *)object { +- (BFTask *)saveCurrentObjectAsync:(PFObject *)object { + PFUser *user = (PFUser *)object; return [_dataTaskQueue enqueue:^id(BFTask *task) { - return [self _saveCurrentUserAsync:object]; + return [self _saveCurrentUserAsync:user]; }]; } diff --git a/Parse/PFConfig.m b/Parse/PFConfig.m index b4d165540..7641a2740 100644 --- a/Parse/PFConfig.m +++ b/Parse/PFConfig.m @@ -8,6 +8,7 @@ */ #import "PFConfig.h" +#import "PFConfig_Private.h" #import "BFTask+Private.h" #import "PFConfigController.h" diff --git a/Parse/PFFile.h b/Parse/PFFile.h index c2313cc03..877aa21bd 100644 --- a/Parse/PFFile.h +++ b/Parse/PFFile.h @@ -220,7 +220,7 @@ PF_ASSUME_NONNULL_BEGIN /*! @abstract Whether the data is available in memory or needs to be downloaded. */ -@property (assign, readonly) BOOL isDataAvailable; +@property (nonatomic, assign, readonly) BOOL isDataAvailable; /*! @abstract *Synchronously* gets the data from cache if available or fetches its contents from the network. diff --git a/Parse/PFGeoPoint.m b/Parse/PFGeoPoint.m index 5912bff9c..6de25d597 100644 --- a/Parse/PFGeoPoint.m +++ b/Parse/PFGeoPoint.m @@ -8,6 +8,7 @@ */ #import "PFGeoPoint.h" +#import "PFGeoPointPrivate.h" #import diff --git a/Parse/PFObject.h b/Parse/PFObject.h index aeb51c725..8afdc946e 100644 --- a/Parse/PFObject.h +++ b/Parse/PFObject.h @@ -97,7 +97,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS /*! @abstract The class name of the object. */ -@property (strong, readonly) NSString *parseClassName; +@property (nonatomic, strong, readonly) NSString *parseClassName; /*! @abstract The id of the object. diff --git a/Parse/PFQuery.h b/Parse/PFQuery.h index 661399a99..08aca7c5b 100644 --- a/Parse/PFQuery.h +++ b/Parse/PFQuery.h @@ -800,12 +800,12 @@ typedef void (^PFQueryArrayResultBlock)(NSArray PF_GENERIC(PFGenericObject) * PF @see fromPin @see fromPinWithName: */ -@property (assign, readwrite) PFCachePolicy cachePolicy; +@property (nonatomic, assign) PFCachePolicy cachePolicy; /*! @abstract The age after which a cached value will be ignored */ -@property (assign, readwrite) NSTimeInterval maxCacheAge; +@property (nonatomic, assign) NSTimeInterval maxCacheAge; /*! @abstract Returns whether there is a cached result for this query. diff --git a/Parse/PFQuery.m b/Parse/PFQuery.m index 0fb3995e1..d3def602a 100644 --- a/Parse/PFQuery.m +++ b/Parse/PFQuery.m @@ -8,6 +8,7 @@ */ #import "PFQuery.h" +#import "PFQueryPrivate.h" #import #import @@ -550,6 +551,7 @@ - (void)whereComparisonPredicate:(NSComparisonPredicate *)predicate { [NSException raise:NSInternalInconsistencyException format:@"LIKE is not supported by PFQuery."]; } + case NSBetweenPredicateOperatorType: default: { [NSException raise:NSInternalInconsistencyException format:@"This comparison predicate is not supported. (%zd)", predicate.predicateOperatorType]; @@ -614,6 +616,7 @@ + (instancetype)queryWithClassName:(NSString *)className normalizedPredicate:(NS } return [self orQueryWithSubqueries:subqueries]; } + case NSNotPredicateType: default: { // This should never happen. [NSException raise:NSInternalInconsistencyException diff --git a/Parse/PFRelation.m b/Parse/PFRelation.m index a6fdb68e2..0952de06b 100644 --- a/Parse/PFRelation.m +++ b/Parse/PFRelation.m @@ -20,9 +20,9 @@ #import "PFObjectPrivate.h" #import "PFQueryPrivate.h" -NSString *const PFRelationKeyClassName = @"className"; -NSString *const PFRelationKeyType = @"__type"; -NSString *const PFRelationKeyObjects = @"objects"; +static NSString *const PFRelationKeyClassName = @"className"; +static NSString *const PFRelationKeyType = @"__type"; +static NSString *const PFRelationKeyObjects = @"objects"; @interface PFRelation () { // diff --git a/Parse/PFUser.h b/Parse/PFUser.h index 3ae63f691..c54ff2bf2 100644 --- a/Parse/PFUser.h +++ b/Parse/PFUser.h @@ -57,7 +57,7 @@ typedef void(^PFUserLogoutResultBlock)(NSError *PF_NULLABLE_S error); @discussion This is only set after a Facebook or Twitter login. */ -@property (assign, readonly) BOOL isNew; +@property (nonatomic, assign, readonly) BOOL isNew; /*! @abstract Whether the user is an authenticated object for the device. diff --git a/Tests/Other/TestCases/TestCase/PFTestCase.m b/Tests/Other/TestCases/TestCase/PFTestCase.m index 1720bf12f..084040342 100644 --- a/Tests/Other/TestCases/TestCase/PFTestCase.m +++ b/Tests/Other/TestCases/TestCase/PFTestCase.m @@ -165,7 +165,7 @@ - (void)assertDirectory:(NSString *)directoryPath hasContents:(NSDictionary *)ex // Check for unexpected files. NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:directoryPath]; NSString *filename = nil; - while (filename = [enumerator nextObject]) { + while ((filename = [enumerator nextObject])) { XCTAssertNotNil(expected[filename], @"Unexpected file %@", filename); } }