diff --git a/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.m b/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.m index 887deba..0285462 100644 --- a/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.m +++ b/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.m @@ -23,6 +23,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION #import "UIAlertView+MKNetworkKitAdditions.h" @implementation UIAlertView (MKNetworkKitAdditions) @@ -39,3 +40,4 @@ +(UIAlertView*) showWithError:(NSError*) networkError { } @end #endif +#endif diff --git a/MKNetworkKit/MKNetworkEngine.m b/MKNetworkKit/MKNetworkEngine.m index a238f97..44637ca 100644 --- a/MKNetworkKit/MKNetworkEngine.m +++ b/MKNetworkKit/MKNetworkEngine.m @@ -190,8 +190,10 @@ + (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object [[NSNotificationCenter defaultCenter] postNotificationName:kMKNetworkEngineOperationCountChanged object:[NSNumber numberWithInteger:(NSInteger)[_sharedNetworkQueue operationCount]]]; #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION [UIApplication sharedApplication].networkActivityIndicatorVisible = ([_sharedNetworkQueue.operations count] > 0); +#endif #endif } else { diff --git a/MKNetworkKit/MKNetworkOperation.m b/MKNetworkKit/MKNetworkOperation.m index 4932304..cd42ace 100644 --- a/MKNetworkKit/MKNetworkOperation.m +++ b/MKNetworkKit/MKNetworkOperation.m @@ -890,6 +890,7 @@ -(void) main { -(void) endBackgroundTask { #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION dispatch_async(dispatch_get_main_queue(), ^{ if (self.backgroundTaskId != UIBackgroundTaskInvalid) { [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskId]; @@ -897,12 +898,14 @@ -(void) endBackgroundTask { } }); #endif +#endif } - (void) start { #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION self.backgroundTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ dispatch_async(dispatch_get_main_queue(), ^{ @@ -915,6 +918,7 @@ - (void) start }); }]; +#endif #endif if(!self.isCancelled) { @@ -1482,6 +1486,7 @@ -(void) operationSucceeded { -(void) showLocalNotification { #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION if(self.localNotification) { @@ -1496,6 +1501,7 @@ -(void) showLocalNotification { [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification]; } #endif +#endif } -(void) operationFailedWithError:(NSError*) error { @@ -1509,9 +1515,11 @@ -(void) operationFailedWithError:(NSError*) error { errorBlock(self, error); #if TARGET_OS_IPHONE +#if !TARGET_IS_EXTENSION if([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) [self showLocalNotification]; #endif +#endif } diff --git a/README.mdown b/README.mdown index cb28766..886394a 100644 --- a/README.mdown +++ b/README.mdown @@ -1,3 +1,4 @@ +加一个测试 This is version 0.87 of MKNetworkKit. Read the [blog post](http://mk.sg/8w) for more. The latest code is still not fully testing on Mac, though iOS is complete. Caching responses and invalidation of cache is not implemented the right way for the Mac target. MKNetworkKit is ready for production use on iOS apps. As on date, it's used by several thousands of apps including [Digg](https://itunes.apple.com/us/app/digg/id362872995?mt=8)