iOS Question Merging OBJC code

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi

This give me an error :
B4X:
#if objc

@import MediaPlayer;
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>


- (NSArray*) getGravity: (CMMotionManager*) manager
{
    CMDeviceMotion *motion = manager.deviceMotion;
    CMAcceleration acc = motion.gravity;
    return @[@(acc.x), @(acc.y), @(acc.z)];
}

- (void)startMotion:(CMMotionManager*)manager
{
   [manager startDeviceMotionUpdatesUsingReferenceFrame: CMAttitudeReferenceFrameXArbitraryCorrectedZVertical];
}

- (void)setAudioSession {
  AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  NSError *err = nil;
  BOOL success = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&err];
  if (success) {
     success = [audioSession setActive:YES error:&err];
   success = [audioSession setPreferredSampleRate:4096 error:nil];
   [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
  }
  if (!success)
  [NSException raise:@"" format:@"Error setting audio session: %@", err];
}

   
#End If


#if objc

@end
@interface B4ILocationManager (beacon)
@end
@implementation B4ILocationManager (beacon)


- (void)locationManager:(CLLocationManager *)manager
        didRangeBeacons:(NSArray*)beacons
               inRegion:(CLBeaconRegion *)region {
              If (beacons.count > 0) {
                [B4IObjectWrapper raiseEvent:self :@"_didrangebeacons:"
                    :@[[B4IObjectWrapper createWrapper:[B4IList new] object:beacons]]];
                }
    }
   

   
#End If

This is the error listing:

B4X:
B4i Version: 6.50
Parsing code.    (0.31s)
Building folders structure.    (0.18s)
Compiling code.    (1.74s)
Compiling layouts code.    (0.12s)
Compiling debugger engine code.    (0.04s)
Building Xcode project    (0.21s)
Sending data to remote compiler.    Error

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_gps.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_gps.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION=12 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_gps.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_gps.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_gps.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_gps.o

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_functions.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_functions.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION=12 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_functions.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_functions.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_functions.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_functions.o

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_core.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_core.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION=12 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_core.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_core.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_mod_core.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_mod_core.o

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION=12 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Atlas\ SOS-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:3116:6: error: implicit declaration of function 'If' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                          If (beacons.count > 0) {
                          ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:3116:28: error: expected ';' after expression
                          If (beacons.count > 0) {
                                                ^
                                                ;
2 errors generated.

The problem seems to revolve around B4ILocationManager. My OBJC is non existant, so help would be appreciated.

Thanks

John.
 
Top