Messing round a little in Xcode, and I was trying to get my app to look at the users music library with the use of MPMediaPickerController.
Following Apples documentation, I added the MediaPlayer.framework to the project, and in my header I've imported , giving me something like this:
#import <GameKit/GameKit.h>
#import <MediaPlayer/MediaPlayer.h>
#interface HelloMusic : UIViewController
{
}
So far so simple. Now, as far as I'm aware I should be able to do
MPMediaPickerController *mp = [[MPMediaPickerController alloc] init];
in my main file and set about launching my picker. Unfortunately XCode stubbronly refuses to admit that there is such a thing as an MPMediaPickerController - if I type MP and hit escape to get code complations I am without any of the MPMedia family. Annoyingly Xcode does recognise any MPMovie... class (from the same framework!). If I try and run the app it compiles fine so it must at least recognise the header from the framework, then chunters along until I get to the assignment of MPMediaPickerController, at which point I get an EXC_BAD_ACCESS, with a console output of
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
pthread_mutexattr_destroy$UNIX2003 called from function _ZN4llvm3sys5MutexC2Eb in image
libLLVMContainer.dylib.
I'm... certain I'm doing something beyond stupid, but I'm stuck nevertheless.
As the class reference states, it's declared in MPMediaPickerController.h. As such, simply adding...
#import <MediaPlayer/MPMediaPickerController.h>
...should solve your problems. :-)
Related
Newbie here. In short: I'm using Arduino to count how many cars enter my garage and have the data sent to firebase. I was able to connect/read/write using Swift 4. Therefore, I decided to install a pod this one to improve the design of the app. The pod is written in objective-C (I've never used the language), so I thought it would be easier to have the firebase in the same class and language as the pod.
Since I have some code written in Swift 4, I decided to create a bridging header in order to "mix and match" both languages in the same project.
Therefore, the issues I am currently facing are:
1 - In the LMViewController.m file I've added:
#import Firebase;
#import FirebaseDatabase;
along with this code inside - (void)viewDidLoad method:
[FIRApp configure];
#property (strong, nonatomic) FIRDatabaseReference *ref;
self.ref = [[FIRDatabase database] reference];
This code automatically raises red flags due to the fact that it is not recognising it. I am using the code exactly as specified on google's firebase website. Firebase for ios.
2 - I have also tried to add the import FirebaseDatabase within swift appDelegate. No success in the .m file tho.
I would appreciate your help in order to understand how can I make xcode not give me errors when creating a firebase reference in order to read from it and assign the value to the pod code.
I just updated my Parse frameworks, which now include Parse.framework, ParseUI.framework, ParseFacebookUtils.framework, and ParseCrashReporting.framework. After importing these frameworks into my swift project and importing the following statements into my bridging file:
#import <Parse/Parse.h>
#import <ParseFacebookUtils/PFFacebookUtils.h>
#import <ParseCrashReporting/ParseCrashReporting.h>
#import <ParseUI/ParseUI.h>
I am getting errors that PFImageView does not have a member named loadInBackground(), although loadInBackground with a completion block works. Similarly, PFObject does not have a member named 'deleteInBackground()', althought .delete() works.
Is anyone else having a similar issue with the new Parse iOS SDK? Am I missing something here, or does this seem like a bug with Parse/Xcode? I've tried cleaning, building, and deleting the derived data for my project multiple times with no luck. Please let me know if there is not enough information provided. Thanks for the help.
Try deleteEventually() instead.
I'm having this weird issue when building my project. The problem is as follows:
My friend and I are working on a project and we're exactly using the same xcode, cocos2d and box2d versions.
His project compiles (builds) fine while mine gives this error when I do:
cassert file not found.
I took a copy of his xcode.project but no problems whatsoever.
I hope this code summarizes better what I'm trying to say:
GameLayer.h
#import bla bla //the usual required files
#class myOwnClass1;
#class myOwnClass2;
myOwnClass1 *test1;
myOwnClass2 *test2;
Now I wanna include the GameLayer.h in either myOwnClass1.h or myOwnClass2.h using #import but it would give me the error!
If I did #class GameLayer; no problems at all.
The thing is in my friend's project he's doing the #import without the error, which is super weird (at least for me)
Advice?
P.S. I know that changing the .m to .mm would solve it but, again, in my friend's project he's using the .m
I guess there is a mismatch of compiler settings between your project and your friend's.
In short: cassert is a C++ header file; you definitely need a C++ compiler to compile it.
Now, my guess is that in your friend's project, the GameLayer.m file is marked as a C++ file, though it has got a .m extension.
To verify that, open your project's (and your friend's) project.pbxproj file in a text editor and look for the GameLayer.m file. You will get this kind of entry:
347F5D94158BA4840058BC21 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
as you see, the lastKnownFileType key says sourcecode.c.objc: this identifies an Objective-C file. If you see sourcecode.cpp.objcpp, that means objective c++.
Hope this helps clarifying it.
For some reason it turned out that creating a new project from scratch solved the problem, I'll mark this as the correct answer for now unless someone else has another opinion.
Here is how I fixed the issue. Cleaning up and recreating the project didn't seem to be a good idea for me.
There are a couple of answers on the web for this issue but they in each didn't help me solve the problem. One is on SO at
cassert file not found but i use Box2d template and the other is on cocos2d-iphone forum,
http://www.cocos2d-iphone.org/forums/topic/cannot-include-box2d-cassert-file-not-found-despite-every-file-being-mm/
Combining the two suggestions kind of worked for me -
Rename all YOUR (not cocos2d or box2d files, just your project files) from .m to .mm
Make sure that on each of the files, on the right pane, “Type” option is set to “Default – Objective C++ Source”
There was another issue for me specifically, may not be an issue for you, I was using the following signature for CCLabelTTF
CCLabelTTF *title = [CCLabelTTF labelWithString:#"Hello" dimensions:CGSizeMake(720.0f, 880.0f) alignment:UITextAlignmentLeft fontName:#"Arial" fontSize:34];
This is deprecated and caused errors all over the place. I am now using the following slightly modified version and the errors fixed -
CCLabelTTF *title = [CCLabelTTF labelWithString:#"Hello" dimensions:CGSizeMake(720.0f, 880.0f) hAlignment:kCCTextAlignmentRight fontName:#"Arial" fontSize:34];
My most recent writeup of this fix can be found at - http://indiangamer.com/how-i-fixed-the-cocos2d-box2d-include-file-not-found-error/
Since there is no easy way to add multi image selection in Appcelerator, I'd like to incorporate this project: WSAssetPickerController - https://github.com/w5mith/WSAssetPickerController into my Appcelerator project.
I'm able to create a simple custom module in XCode/ObjC, and call it from Appcelerator, but I'm not sure how to call code that has a UI such as WSAssetPickerController does. Any tips would be appreciated.
Here is some code I have working now. This is pretty much boiler plate Appcelerator Custom Module stuff contained in an ObjC implementation class:
https://gist.github.com/3976969
Then in my Appclerator project, I load this module like this:
// in app.js
var myModule = require('com.example.test');
Ti.API.info("--->module loaded is ---> "+myModule);
// in testing.js
function createFoo() {
myModule.sayHello();
}
So, with this in place I am able to create a custom module in ObjC, load it up into Appcelerator and call a method on it.
I now want to the open source module WSAssetPickerController - however, this is quite a bit more sophisticated than my sayHello() method, as it contain a user interface view that needs to be loaded and displayed from Appcelerator. The documentation says to include all the code from the "src" directory (which I have done) into my ObjC project, then use code like this to load it:
WSAssetPickerController *controller = [[WSAssetPickerController alloc] initWithDelegate:self];
[self presentViewController:controller animated:YES completion:NULL];
But, this not working for me. Within XCode, I get a compiler warning on the first line of:
"Sending 'ComExampleTestModule *' to parameter of incompatiple type 'id
UPDATE: after some changes here is what I have now:
I modified the #interface line in ComExampleTestModule.h to:
#interface ComExampleTestModule : TiModule <WSAssetPickerControllerDelegate>
and I added this import statement:
#import "WSAssetPicker/WSAssetPicker.h"
but I am still getting compiler warnings in my .m file like this: "Instance method '-dismissViewControllerAnimated:completion' not found (return type defaults to 'id'.......
Thanks for the help.
what have you got written so far? Can you post it somewhere??
also take a look at some code I have in my repo... it might get you started
http://blog.clearlyinnovative.com/post/27531529814/titanium-appcelerator-quickie-cardio-integration
I am running cocos2d 1.0.1. I am getting Warning Errors regarding this code saying that the initWithFrame method is not found. I believe it is responsible for crashing my application, while logging "Unknown Error"
glView = [[EAGLView alloc] initWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:GL_DEPTH_COMPONENT24_OES
preserveBackbuffer:NO];
This is the Build WARNING I got:
WARNING: No '-initWithFrame: pixelFormat:
depthFormat:preserveBackbuffer:' method found
Reading forum posts from a year ago, Riq recommended the above method posted, but that did not work.
I do have my EAGLView.h/m files, they are under the iOS subFolder of the Platforms subFolder.
I tried adding an #class EAGLView; declaration in the App.h file, but I still couldn't even get Xcode to jump to the definition of the EAGLView class. Moving the two EAGLView .h and .m files up to the main Cocos2d folder did nothing either.
My question is: how do I get these files to talk, because there's clearly a lack of communication.
The format of EAGLView initWith… methods have changed. In your case you simply need to add the remaining additional parameters as described in the link.