iOS convert bool value to string

ios

Solution

If `isConnected` is a `BOOL` type it shouldn't even compile. If it's `NSNumber` you should get "1" or "0".

Do you want "YES" to "NO" string? Solution:

A) If a BOOL type:

NSString *connectedString = self.selectedBeacon.isConnected ? @"YES" : @"NO";

B) If `NSNumber` add a category method to this class like:

- (NSString *)boolValueString {
    // if this contains BOOL value
    return [self boolValue] ? @"YES" : @"NO";
}

Problem

I have a bool value associated with a call I want to pass out of my iOS program as a string. I have tried the following: ``` NSString *connectedString = [self.selectedBeacon.isConnected stringValue]; ``` But I'm not getting anything out. Can someone please correct me?

Original source