Code Monkey home page Code Monkey logo

Comments (4)

kstenerud avatar kstenerud commented on July 21, 2024

Hmm strange. I just ran the iOS example in the profiler and cpu usage remained at 0 except for when starting the app, and a little blip when I pressed the button. Can you tell me what you put in the basic example program that hit 100%?

from ksreachability.

kevinrenskers avatar kevinrenskers commented on July 21, 2024

Create new iPhone project in Xcode, and add KSReachability via Cocoapods (pod 'KSReachability). This very minimal setup will get 100% CPU:

AppDelegate.h:

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) KSReachability *reachability;
@property (strong, nonatomic) ViewController *viewController;

@end

AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.reachability = [KSReachability reachabilityToHost:@"google.com"];
    self.reachability.notificationName = kDefaultNetworkReachabilityChangedNotification;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleReachabilityChanged) name:kDefaultNetworkReachabilityChangedNotification object:nil];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    return YES;
}

- (void)handleReachabilityChanged {
    NSLog(@"handleReachabilityChanged");
}

@end

from ksreachability.

kstenerud avatar kstenerud commented on July 21, 2024

OK I see the problem: The podspec in cocoapods points to v1.1, which had a major bug that caused high CPU load. The correct tag is 1.3.

Once I figure out how to update podspecs in cocoapods I'll point it to the latest release.

from ksreachability.

kevinrenskers avatar kevinrenskers commented on July 21, 2024

Easiest solution is to add the podspec file to your repo (just like I've done in one of my repos). Once you have push access to the cocoapods spec repo, you can then simply run pod push master.

To get push access, simply fork their Specs repo, add the new podspec file, send a pull request and ask for push access.

from ksreachability.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.