iOS Question Problems with OBJC

fbritop

Active Member
Licensed User
Longtime User
Hi there,
After installing b4i 2.0 I could never compile again any programs that contains OBJC tags.

Within my code I have the following OBJC Sub

B4X:
#If OBJC
@import CoreTelephony;

- (NSString *) SIM
{
    NSString *nameComplete;
    CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier* carrier = info.subscriberCellularProvider;
    NSString *mobileCountryCode = carrier.mobileCountryCode;
    NSString *carrierName = carrier.carrierName;
    NSString *isoCountryCode = carrier.isoCountryCode;
    NSString *mobileNetworkCode = carrier.mobileNetworkCode;
    nameComplete = [NSString stringWithFormat: @"%@;%@;%@;%@", mobileCountryCode, carrierName ,isoCountryCode, mobileNetworkCode];
    return nameComplete;
}
#end if

But I keep getting this error when I compile:

import of module 'CoreTelephony' appears within 'b4i_main'

Out: Build settings from command line:
ARCHS = armv7
CODE_SIGN_IDENTITY = iPhone
CONFIGURATION_BUILD_DIR = /Users/administrator/Documents/UploadedProjects/XXXXXXX/Payload
OTHER_CODE_SIGN_FLAGS = --keychain XXXXXXX
PRODUCT_NAME = LlaveMovil
PROVISIONING_PROFILE = XXXX...

This error was not happening before installing b4i 2.0. I have tried to compile with both, 1.5 and 2.0

Any thoughts on what am I doing wrong?

Thanks
FBP
 

fbritop

Active Member
Licensed User
Longtime User
Erel,
I found a workarround which did work

B4X:
#If OBJC
//@import CoreTelephony;
#import<CoreTelephony/CTCallCenter.h>   
#import<CoreTelephony/CTCall.h>  
#import<CoreTelephony/CTCarrier.h>   
#import<CoreTelephony/CTTelephonyNetworkInfo.h>

- (NSString *) SIM
{
    NSString *nameComplete;
    CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier* carrier = info.subscriberCellularProvider;
    NSString *mobileCountryCode = carrier.mobileCountryCode;
    NSString *carrierName = carrier.carrierName;
    NSString *isoCountryCode = carrier.isoCountryCode;
    NSString *mobileNetworkCode = carrier.mobileNetworkCode;
    nameComplete = [NSString stringWithFormat: @"%@;%@;%@;%@", mobileCountryCode, carrierName ,isoCountryCode, mobileNetworkCode];
    return nameComplete;
}
#end if

On the other hand, do you know any simple device (a bluetooth button), that when the user press this button, and the device is paired with the phone, then it performs some action over the app on the device, that it would work on both iOs and Andoird?

Thanks
FBP
 
Upvote 0
Top