SCNetworkConnection - Dictionary/Subdictionary

  • Hi,

    can someone please help me?

    I need to get the  "ConnectTime"  from the
    Dictionary "SCNetworkConnectionExtendedStatus" subdirectory "PPP"

    Sorry, I have no idea how to fetch this... I tried

      id a = [[SCNetworkConnectionCopyExtendedStatus
    objectForKey:@"PPP"] objectForKey:@"ConnectTime"];
      if (a != NULL) {
        printf ("%i\n", [a intValue]);
      }
      else {
        printf ("nicht verbunden\n");
      }

    But it compiled with an error message: /Users/sl/stats/stats.m:85:
    warning: invalid receiver type '¿¿v'

    Maybe someone can bring into the darkness?

    Thanks for your help,

    Stefan
  • Hi,

    I have adapted this and now it is compiling correct - but the result
    in terminal is not working correct:

    NSDictionary *tmpDict = [NSDictionary
    dictionaryForKey:@"SCNetworkConnectionCopyExtendendStatus(scncRef)"];

        id i = [[tmpDict objectForKey:@"PPP"] objectForKey:@"ConnectTime"];
        if( i!= nil)
          printf("%i\n", [i intValue]);
        else
          printf("nicht verbunden\n");

    Terminal output:

    iBook-G4:~/stats/build/Debug sl$ ./stats -t
    Time
    2007-10-03 21:39:47.110 stats[3160] *** _NSAutoreleaseNoPool():
    Object 0x50cd10 of class NSCFString autoreleased with no pool in
    place - just leaking
    2007-10-03 21:39:47.111 stats[3160] *** +[NSDictionary
    dictionaryForKey:]: selector not recognized
    2007-10-03 21:39:47.112 stats[3160] *** _NSAutoreleaseNoPool():
    Object 0x50db90 of class NSCFString autoreleased with no pool in
    place - just leaking
    2007-10-03 21:39:47.112 stats[3160] *** _NSAutoreleaseNoPool():
    Object 0x50e220 of class NSCFString autoreleased with no pool in
    place - just leaking
    2007-10-03 21:39:47.113 stats[3160] *** _NSAutoreleaseNoPool():
    Object 0x50e200 of class NSException autoreleased with no pool in
    place - just leaking
    2007-10-03 21:39:47.113 stats[3160] *** Uncaught exception:
    <NSInvalidArgumentException> *** +[NSDictionary dictionaryForKey:]:
    selector not recognized
    Trace/BPT trap
    iBook-G4:~/stats/build/Debug sl$

    I don*t have a clue how to handle this...

    thanks for your help,

    Stefan

    serialport c

    On Oct 3, 2007, at 8:25 PM, Stefan Lehrner wrote:

    > Hi,
    >
    > can someone please help me?
    >
    > I need to get the  "ConnectTime"  from the
    > Dictionary "SCNetworkConnectionExtendedStatus" subdirectory "PPP"
    >
    > Sorry, I have no idea how to fetch this... I tried
    >
    >
    > id a = [[SCNetworkConnectionCopyExtendedStatus
    > objectForKey:@"PPP"] objectForKey:@"ConnectTime"];
    > if (a != NULL) {
    > printf ("%i\n", [a intValue]);
    > }
    > else {
    > printf ("nicht verbunden\n");
    > }
    >
    > But it compiled with an error message: /Users/sl/stats/stats.m:85:
    > warning: invalid receiver type '¿¿v'
    >
    > Maybe someone can bring into the darkness?
    >
    > Thanks for your help,
    >
    > Stefan
    >
  • Check the documentation for NSDictionary and for dictionaryForKey.
    Here's the hint from your trace:

    > 2007-10-03 21:39:47.111 stats[3160] *** +[NSDictionary
    > dictionaryForKey:]: selector not recognized

    H
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today