I have installed a Metaio SDK in my IOS app and currently i am getting an error in the MetaioCloudPluginViewController.h that the vector file is not found, i have tried to change the type from .m or .mm where i have used this sdk file but unfortunately if i would do it then the new errors are popping up such as "comparison between pointer and integer". I have changed few things in my build setting but still the result is same.
This the file which i am including in the stated viewcontroller.
#include <vector>
The below code is used in one of the viewcontroller.m file.
- (IBAction)onStartPushed:(id)sender {
// Create a new ARViewController. All channel details and properties are defined in that class.
// see ARViewController.mm for the implementation
ARViewController* metaioCloudPlugin = [[ARViewController alloc] init];
// present the viewcontroller
[self presentViewController:metaioCloudPlugin animated:YES completion:nil];
// release it, because it's retained as modalViewController
//[metaioCloudPlugin release];
}
Thanks for your time.
You need to rename your viewcontroller.m to viewcontroller.mm file because there is a C++ code.
Hope this helps.
Related
I am tinkering with the sample project "SpatialAudio" from Google VR SDK for Unity, to implement it in iOS.
I built it in Unity using the latest GVR SDK, so I had to replace a few deprecated keywords (GvrAudioSource instead of CardboardAudioSource, etc.)
If I build it in Xcode just as Unity gives it to me, it runs fine in the physical device.
Then, I tried to edit the Unity-generated file 'main.mm' to change the default App Controller (UnityAppController) to a new one, let's call it NewAppController.
// main.mm
...
const char* AppControllerClassName = "UnityAppController";
...
//UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]); // old
UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:"NewAppController"]); // new
NewAppController is a class which inherits from UnityAppController and does not override any of its methods or properties, like this:
#interface NewAppController : UnityAppController
#end
#implementation NewAppController
#end
I thought that it should work exactly the same as before, but now I get the following warning in runtime:
"Audio effect GVR Audio Renderer could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly."
Everything else works just fine: I can see the video and even hear the sounds, but only they are not 'spatialized'.
I am using:
GVR SDK 1.1,
Unity 5.5.0f3,
iOS 10.1.1
I found the solution. I was missing two important things: First, messing with main.mm causes a lot of trouble. The correct approach for defining a custom App Controller is to create a subclass of UnityAppController and adding the macro IMPL_APP_CONTROLLER_SUBCLASS(name_of_the_class) at the bottom of its .mm file. Second, Unity automatically generates a custom app controller, called CardboardAppController, which is located in the build directory, under 'Libraries/Plugins/iOS'. One of its functions is registering the unity audio effect plugin. I was bypassing this file without knowing, causing the audio renderer to not initialize properly. So my solution was to comment out the macro at the end of the file CardboardAppController.mm (line 71):
//IMPL_APP_CONTROLLER_SUBCLASS(CardboardAppController)
And defining the new custom controller as a subclass of CardboardAppController:
#import "CardboardAppController.h"
#interface NewAppController : CardboardAppController
#end
#implementation NewAppController
#end
IMPL_APP_CONTROLLER_SUBCLASS(NewAppController)
I integrate Aviary SDK on my app to enhance my app image editor feature. I read its documents, run its sample code and it works fine. But when run on my app, I face an issue. It crashed EXC_BAD_ACCESS after run over a method
[AFOpenGLManager beginOpenGLLoad];
I followed the setup guide on Aviary document
https://developers.aviary.com/docs/ios/setup-guide#project-setup
At first, I just create a Singleton manager to manage. I call [AFOpenGLManager beginOpenGLLoad]; on init function
- (id)init {
if (self = [super init]) {
[AFOpenGLManager beginOpenGLLoad];
}
return self;
}
- (void) launchPhotoEditorWithImage:(UIImage *)editingResImage
highResolutionImage:(UIImage *)highResImage
fromController:(UIViewController *)controller
{
// Customize the editor's apperance. The customization options really only need to be set
once in this case since they are never changing, so we used dispatch once here.
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self setPhotoEditorCustomizationOptions];
});
// Initialize the photo editor and set its delegate
AFPhotoEditorController * photoEditor = [[[AFPhotoEditorController alloc]
initWithImage:editingResImage] autorelease];
[photoEditor setDelegate:self];
// If a high res image is passed, create the high res context with the image and the
photo editor.
if (highResImage) {
[self setupHighResContextForPhotoEditor:photoEditor withImage:highResImage];
}
// Present the photo editor.
[controller presentViewController:photoEditor animated:YES completion:nil];
}
After run over the init function, it crashed on
Do I miss somethings, the sample code run well.
Edit 1:
compileShader is called from createProgram but I can read this method
Edit 2:
I realize somethings. My app project has a lib named libmediastreamer_voip.a . I think there is misunderstanding. I mean maybe Aviary lib and libmediastreamer_voip.a lib also have the function named compileShader. So when on Aviary lib calls compileShader it runs on compileShader on Aviary lib but run into compileShader on libmediastreamer_voip.a.
I wonder I could be like that? I create a new project and integrate Avairy SDK, it works well, just integrate to my app it crashes
I am a member of the iOS team at Aviary. This is caused by a conflict between our compileShader function and yours. Our function was not properly namespaced and resulted in the conflict. We will be addressing this in the next release of the SDK.
Michael
What I think about it. Check your shader value. It should have correct shader path from your resources or somewhere else with appropriate type (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER).
Seems to me you've it's nil
I have gone through the ADLivelyTableView demo project but have not been able to import the ADLivelyTableView h and m files into my project successfully. It appears that the main issue is to do with ARC. I have experimented by converting the demo project into arc, specifically but converting just the LDMasterView.m file, and this simply removes all references to releasing objects, and so after this conversion, the use ARC option under build settings is now ON and the app works. So i figured that the ADLivelyTableView .m and .h files dont need converting, but when these are imported into my project, i get all sorts of ARC errors for these two blocks of code:
if (block != _transformBlock) {
Block_release(_transformBlock);
_transformBlock = Block_copy(block);
}
}
and
#implementation ADLivelyTableView
- (void)dealloc {
Block_release(_transformBlock);
[super dealloc];
}
I dont get why these errors didnt show when turning on ARC in the demo project. id prefer finding a solution rather than trying to import my entire application to the demo project instead! The errors are as follows:
ARC Casting Rules: Cast of block pointer type 'ADLivelyTransform (aka NSTimeINterval (^)CALayer*_strong, float) to C pointer type 'const void *' required a bridged cast.
ARC Casting Rules: Cast of C Pointer ....(Same as above)
Also, once this issue is resolved, it is supposed to be as simple as just importing the ADLivelyTableView .h and .m files and then adding the line :
ADLivelyTableView * livelyTableView = (ADLivelyTableView *)self.tableView;
livelyTableView.initialCellTransformBlock = ADLivelyTransformFan;
into my viewDidLoad section? or is that bit supposed to be edited for my specific table?
Thanks for your help,
Regards,
Rami
You can modify the Compiler Flags for ADLivelyTableView.m.
Kindly try to add -fno-objc-arc.
EDIT:
I think I have fixed my issues. Thank you for the help - I really appreciate it.
Original Question:
I am new to objective-c and iOS programming, so hopefully my issues are not difficult to correct. I am trying to add the ability to open a file from Dropbox to my simple iOS application. I have been following the tutorial here:
http://www.mathiastauber.com/integration-of-dropbox-in-your-ios-application-making-api-calls/
I have so far successfully gotten my app to link to my Dropbox account and display the "link successful" message.
Now I am having trouble using the DBRestClient. I have the following code currently:
myviewcontroller.h
...
#end
DBRestClient *restClient;
myviewcontroller.m
- (DBRestClient *)restClient {
if (!restClient) {
restClient =
[[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate = self;
}
return restClient;
}
I am getting an error on the line
restClient.delegate = self;
that says
"Assigning to 'id<DBRestClientDelegate>' from incompatible type 'myviewcontroller'"
What could be going wrong? I have read through every example I can find and can see no issues with what I am trying to do.
If I try to cast by doing the following, it does not work
restClient.delegate = (id)self;
I have also found that if I remove the code in myviewcontroller.m and only have the variable declaration in the header file (as shown above) I get an error that says "Apple Mach-O Linker Error"
I would greatly appreciate any help you can provide. I am very much stuck with this problem.
In your header file you need to specify that you adhere to the DBRestClientDelegate's protocol.
For example:
#interface MyViewController: UIViewController <DBRestClientDelegate>
If you're already adhering to other protocols, simply add the DBRestClientDelegate and comma seperate, such as...
#interface MyViewController: UIViewController <UITableViewDelegate, DBRestClientDelegate>
For more information, I'd recommend a read of the Delegation section of Cocoa Core Competencies, especially as you'll be encountering delegates (and indeed perhaps defining your own protocols, etc.) a lot in Cocoa.
The error is because the right side of restClient.delegate = self; is not of type id<DBRestClientDelegate>
id<DBRestClientDelegate> is basically any object that conforms to the DBRestClientDelegate protocol
The first step (maybe only step) to removing the error is in your Myviewcontroller.h file
change
#interface Myviewcontroller : UIViewController //<-- my best guess at your interface line
to
#interface Myviewcontroller : UIViewController <DBRestClientDelegate>
Apple's "QA:1702:How to capture video frames from the camera as images using AV Foundation" is "broken"without additional ivar code.
I found a fix - but what is an ivar and what is it doing in this case?
Here is the code that has to be added to Apple's TestAVViewController.h file:
#interface TestAVViewController : UIViewController <AVCaptureVideoDataOutputSampleBufferDelegate>
#property AVCaptureSession *session;
#end
Here is the code that must be added to Apple's TestAVViewController.m file:
#implementation TestAVViewController
#synthesize session=ivarSession; // this creates an ivar
By adding both of those sections (which Apple does not provide), the following line will stop throwing a compilation error:
[self setSession:session];
What is the "session = ivarSession" doing that is preventing the compilation error? Why does it make Apple's code work?
The code you added creates and initializes a member variable.
Are you sure you copied the code correctly? The version I'm looking at on the page you linked to has session defined and initialized at the top of the - (void)setupCaptureSession message and that is the only message it is used in. This really should be a local variable, not a member variable.