Cocos2D with new RevMobAds framework - cocos2d-iphone

Integrated new RevMob.frmework in Cocos2D games.
Now getting many compilation error in my Cocos2D 1.0 game and only linker error in other cocos2D 2.0 game.
In Cocos2D 2.0, Linker errors are:
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
Which system framework missed? Already added StoreKit.framework
In cocos2D 1.0, along with these linker error, getting some compilation errors too.
It is showing "Expected a property attribute before *, in below line(in RevMobAds.framewors)
#property (nonatomic, strong) NSArray *supportedInterfaceOrientations;
How can I over come all these problem and get new revMob sdk in cocos2d game?

This errors happen due to the use of LLVM GCC 4.2 as a compiler, to solve this issues just make the following changes:
RevMobBanner.h
line 35: change "strong" to "retain"
#property (nonatomic, retain) NSArray *supportedInterfaceOrientations;
RevMobButton.h
line 51: erase "atomic"
#property (readonly) RevMobButtonStatus status;
RevMobFullscreen.h
line 25: change "strong" to "retain"
#property(nonatomic, retain) NSArray *supportedInterfaceOrientations;

Linker error:
Make sure RevMob.framework is added to the target's "Link Binary with Libraries" build phase.
Compiler error:
Looks fine to me. Make sure #import is imported in that file. Better yet, add it to the prefix.pch if it's not there.
If you continue having issues I suggest getting support directly from RevMob.

Be sure to have the RevMob and StoreKit Frameworks added in the Build Phases: http://sdk.revmob.com/ios
Also, trying to upgrade your XCode, because this is related to a incompatibility issue with old versions of iOS.
Or wait for a new version of the SDK that may have this incompatibility issue fixed.

Related

Cocoa Exception in Debug mode only

I'm getting a strange exception when using Cocoa together with a personal C++ library, while the exception only occurs in debug mode - in release mode everything is fine. And to stress that, it suffices to link my C++ library to get the exception, I don't need to call my library at all.
The error I get is "Exception: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)".
The C++ library is built using CMake and the mode is determined by the internal "CMAKE_BUILD_TYPE". The library can be found on GitHub, though I don't think that anyone wants to build it. Also because it is quite huge, I don't think that someone wants to look at the code.
A very minimal example to demonstrate the error is the following one:
#include <Cocoa/Cocoa.h>
int main()
{
[NSApplication sharedApplication];
printf("success\n");
return 0;
}
As you can see, this example does not use my lib at all.
Compiling it with "clang main.mm -framework Cocoa" works just fine
Compiling it with "clang main.mm -framework Cocoa -lmylib" works also. "mylib" is built here with "-DCMAKE_BUILD_TYPE=Release"
Compiling it with "clang main.mm -framework Cocoa -lmylib_d" yields the above exception. "lmylib_d" is built here with "DCMAKE_BUILD_TYPE=Debug". It prints: "Segmentation fault: 11".
I don't understand it. What could I possible have done in my library that crashes Cocoa just because I link to it? The only thing that could come to my mind is that I have defined my own global operator new and delete. Still, Cocoa wouldn't use those, right?
Here is the full stack trace:
(anonymous namespace)::get_registry() (.8898) 0x00007fff564afd79
SLSNewConnection 0x00007fff56473dc4
SLSMainConnectionID 0x00007fff56474a87
_CFAppSleepSetupCoreGraphics 0x00007fff34649091
____CFRunLoopSetOptionsReason_block_invoke_2 0x00007fff34648738
_dispatch_client_callout 0x00007fff5c43ddb8
dispatch_once_f 0x00007fff5c43dd6b
__CFRunLoopSetOptionsReason 0x00007fff34646ff3
_LSApplicationCheckIn 0x00007fff35ae7abb
_RegisterApplication 0x00007fff32ec192c
GetCurrentProcess 0x00007fff32ec064c
MenuBarInstance::GetAggregateUIMode(unsigned int*, unsigned int*) 0x00007fff3391e4ab
MenuBarInstance::IsVisible() 0x00007fff3391e435
_NSInitializeAppContext 0x00007fff31bc1197
-[NSApplication init] 0x00007fff31bc0590
+[NSApplication sharedApplication] 0x00007fff31bc01e6
main main.mm:5
start 0x00007fff5c477015
start 0x00007fff5c477015
Thanks for any help in advance!
Does your library have any static initializers? Or, link to other libs that do? Those are run before main is called, and if they could be causing issues. Especially if they try to interact with Foundation/AppKit.
Regardless, I'm fairly sure it is not safe to use NSApplication this way. I believe you must access it within the context of a main thread which calls NSApplicationMain to setup the underlying AppKit machinery. Since you are crashing within that machinery, I think that is the underlying issue.
Indeed #Kai Guther was correct. Cocoa was using my overridden global new. Apparently I had a bug in my replaced new operator. After a bit of refactoring of that function, it works now.
Thanks for the important information... I think without that guess I would've searched for ages for that terrible bug...

Why am I NOT getting C4192 when importing msxml6?

We been instructed to eliminate all level 3 warnings and have been specifically told to address C4192.
My code does fall into the "bad code" example that causes C4192
#import "msxml6.dll" named_guids
and the "good code" is easy enough to implement
#import "msxml6.dll" exclude("ISequentialStream","_FILETIME")named_guids
The only problem, is that I just do not get this warning. I'm importing version 6.30.7601.18431 of msxml6.dll, and no matter what I do, this warning just does not manifest.
I also imported it again, specifying the no_auto_exclude option and could find no reference to ISequentialStream or _FILETIME in the generated tli and tlh files.
I'm about to simply update to use the "good" code and go on, but I'd still like to know what is happening.
This is specifically an issue because new version of MSXML6.0 changed declarations , especially from Win10 OS onwards.
We already encountered this warning message with our legacy code base having 'bad code' , which you mentioned in your question.
In your case, your system is having older version of MSXML6.DLL (present in "C:\Windows\System32 or SysWow64").
Hope this calrifies your query.

iOS AWS SDK AWSCognitoIdentityProviderModel.h compile error

I've been working with Amazon Web Services iOS SDK and came across an interesting compile error due to a line in the SDK.
In AWSCognitoIdentityProviderModel.h the error appears at the line:
#property (nonatomic, strong) NSNumber * _Nullable mutable;
The error states "Expected member name or ';' after declaration specifiers".
It looks like Xcode does not like using the keyword 'mutable' as a property name and will not compile.
However, this demo uses the same exact SDK with the same offending line and compiles just fine.
Why is this an error in one project and not an error in the demo project?

OpenCV error SVM identifier undefined

I've got an issue with OpenCV 3.0.0.
I have built it from sources with Cmake and Visual Studio 2013, because I needed to add a loading method from a "string" in the "StatModel" class. To do so, I edited the "ml.hpp" file (where there is already a "load" method).
I'm trying to use the library in a C++/CLI project. Everything is fine with classes like "Mat" for exemple, but when I use "SVM" in my code, Visual Studio show me this error:
IntelliSense: identifier "SVM" undefined
The funny thing is that I can access to the definition of it with a right-click and get a defined identifier with cv::ml::SVM.
The tutorial I followed to link OpenCV libraries in my project can be seen here.
I don't know what is wrong with it and didn't found anything related, perhaps I miss something related to my edit?
Can you help me please?
as of opencv3.0, you will have to use:
Ptr<ml::SVM> svm = ml::SVM::create();
(no, you can't use a 'stack instance, like SVM svm; anymore. also note the additional namespace)
(( also, if all you got is a youtube video, you basically got nothing ))

BPM detection in iOS using soundtouch library

I am trying to implement beatdetection within an iOS application. I found a fairly simple framework called SoundTouch and tried to implement this according to
iOS SoundTouch framework BPM Detection example
Unfortunately none of my following efforts seem to work and am currently in a deadlock state hence my post to Stackoverflow.
I took the following steps:
Create single-view-based project
Imported the
Renamed mainViewController.m to ViewController.mm to make it compatible with c++
Instructed the UIViewController class of the ViewController to conform to the AVFoundationPlayerDelegate protocols.
Copy/Pasted the solution #MrHappyAsthma posted to his question
Refactored
player =[[AVAudioPlayer alloc] initWithData:data error:NULL];
to
AVAudioPlayer *player =[[AVAudioPlayer alloc] initWithData:data error:NULL];
Now the compiler is complaining on:
soundtouch::SAMPLETYPE sampleBuffer[len]; (use of undeclared variable soundtouch)
soundtouch::BPMDetect BPM(player.numberOfChannels, [[player.settings valueForKey:#"AVSampleRateKey"] longValue]); (use of undeclared variable soundtouch)
BPM.inputSamples(sampleBuffer, len/player.numberOfChannels); (use of undeclared variable BPM)
NSLog(#"Beats Per Minute = %f", BPM.getBpm()); (use of undeclared variable BPM)
I think my knowledge on C++ isn't what it should be and the objects soundtouch and BPM should be declared/initialized.
Thanks folks!
You need do the following in order to compile th project:
add #import <SoundTouch/BPMDetect.h> to your ViewController.mm;
add AVFoundation framework to your target (see picture);
set the language settings as shown in picture (specifically, use GNU C++ libstdc++).
I haven't tried to run the program, but it builds at least.