0

Appleが提供するRechablity.hとRechablity.hを使用しており、これらのファイルを使用して、次のようなコードを追加しています

#pragma mark Rechability method

/**
* reachabilityChanged()
* @desc Check the internet connection
* @param NSNotification note is the notification of internet state changed
*/

- (void) reachabilityChanged: (NSNotification* )note {

Reachability* curReach = [note object];
NSParameterAssert([curReach isKindOfClass: [Reachability class]]);
[self updateInterfaceWithReachability: curReach];
}

/**
* updateInterfaceWithReachability()
* @desc Update the internet connection state
* @param Reachability curReach is the instance of Reachbility
*/

- (void) updateInterfaceWithReachability: (Reachability*) curReach {

if(curReach == internetReach) {

    NetworkStatus netStatus = [curReach currentReachabilityStatus];
    BOOL connectionRequired = [curReach connectionRequired];
    NSString* statusString = @"";

    switch (netStatus) {

        case NotReachable: {

            statusString = @"Access Not Available";
            connectionRequired = NO;
            isInternetAvailable = FALSE;
            break;
        }

        case ReachableViaWWAN: {

            statusString = @"Reachable WWAN";
            isInternetAvailable = TRUE;
            break;
        }

        case ReachableViaWiFi: {

            statusString = @"Reachable WiFi";
            isInternetAvailable = TRUE;
            break;
        }
    }

    if(connectionRequired)
        statusString = [NSString stringWithFormat: @"%@, Connection Required", statusString];
    //UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Gmmabling Gambit" message:statusString delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
    //      [alert show];
    //      [alert release];
    //NSLog(@"%@",statusString);
}
}

/**
* internetCheck()
* @desc store the internet connection state
* @return BOOL internet is available or not
*/

- (BOOL)internetCheck {

return isInternetAvailable;
}

systemConfiguration.framework と Security.framework を追加しましたが、このタイプのエラーが発生しました

clang: error: linker command failed with exit code 1 (use -v to see invocation)
4

2 に答える 2

0

.m fileこのエラーは通常、 に を追加していない場合に発生しますbundle resources。したがって、これらのファイルが追加されているかどうかをクロスチェックするか、実装ファイルを追加してください。Build Phases -> Compile resourcesに移動して同じことを行い、.m ファイルを追加します。

それが機能するかどうか教えてください:)

お役に立てれば!

于 2013-02-09T12:28:00.683 に答える
0

ビルド設定で、ビルド アーキテクチャで検索し、その値が No の場合は Yes に置き換えます。作品かもしれません。プロジェクトとターゲットの両方を変更する必要があります。

于 2013-02-09T13:06:02.303 に答える