答案 0 :(得分:0)
声明id referance变量
#import <Cocoa/Cocoa.h>
id refToSelf;
比使用
打电话[refToSelf cameraCapture];
答案 1 :(得分:0)
到目前为止,你有正确的线条。但是你忘了在你的.c
中包含.h文件假设您要cameraCapture()
在mycclass.c
文件中调用mycclass.c
方法。
在 #include "myiosclass.h"
void cameraCapture(){
//your c code goes here...
}
myiosclass.h
在extern void cameraCapture();
myiosclass.m
在-(void)myMethod {
cameraCapture(); //Called your C method.
//Rest of objective c code ...
}
{
"rtVisitInfoOpObjV1":{
"version":"1",
"visitorId":"vis1",
"dwellTime":"0",
"poiId":"poi1",
"srId":"sr1",
"zoneId":"zone1",
"poiProximityConfidence":"0",
"zoneProximityConfidence":"0",
"poiPresenceConfidence":"15",
"zonePresenceConfidence":"0",
"normalizedTime":"1489574975000"
}
}
希望它会对你有所帮助。
答案 2 :(得分:0)
将当前视图控制器作为c方法中的参数传递并使用
void CameraCaptureFromC(long cCameraClient,
const char *imageName,
void *object,
MasterViewController *vc) {
NSLog(@"glfm:Camera Call");
[vc addAllImages];
//your code
}
答案 3 :(得分:0)
//
// ViewController.m
// test
//
// Created by colorsMacBook on 16/03/17.
// Copyright © 2017 colors software. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
someMethod();
}
void someMethod(){
printf("test123\n");
[ViewController someMethod2:@"Calling objective C Method from C method"];
}
+(void)someMethod2:(id)sender{
NSLog(@"Message: %@",sender);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
控制台日志
test123 2017-03-16 13:22:02.858测试[1198:240019]消息:从C方法调用目标C方法