in Mopub-SDK for iOS.there is an error in calling "mp_safe_block" method.
Macro definition:
// Macros for dispatching asynchronously to the main queue
#define mp_safe_block(block, ...) block ? block(__VA_ARGS__) : nil
Called as:
mp_safe_block(complete, NSError.sdkInitializationInProgress, nil);
Error message:
Left operand to ? is void, but right operand is of type 'nullptr_t'
maybe this error has nothing to do with the SDK itself. how to fix it ?
PS:
that sdk code run correctly in a new xCode project created by myself. but there is an error in a Xcode-project builded by MMF2(clickTeam fusion)
and this xCode-project version is too old. I updateded setting of Xcode.but it still an error.
Related
I'm wondering if LLVM fatal errors are really "fatal" - ie. they invalidate the entire state of the system and are not recoverable.
For example (I'm using the llvm-c interface), the default behavior of the following code:
LLVMMemoryBufferRef mb = LLVMCreateMemoryBufferWithMemoryRange(somedata, data_length, "test", 0);
LLVMModuleRef module;
if (LLVMParseBitcode2(mb, &module) != 0) {
fprintf(stderr, "could not parse module bitcode");
}
is that if the pointer somedata points to invalid bitcode, the fprintf is never executed, but instead the entire process aborts with its own fatal error message on stderr.
However, there is supposedly an interface to catch such errors: LLVMFatalErrorHandler. However, after installing an error handler, the process still just aborts without calling the error handler.
The documentation in LLVM is very poor overall, and the C interface is barely documented at all. But it seems like super-fragile design to have the entire process abort in a mandatory way if some bitcode is corrupt!
So, I'm wondering if "fatal" here implies, as usual - that if such an error occurs, we may not recover and continue using the library (for example trying some different bitcode or repairing the old one, for example), or if it is not really a "fatal" error and we can have the FatalErrorHandler or some other means of catching and notify, or take other remediating actions, and continue the program.
Ok, after reading through the LLVM source for 10+ hours and enlisting the help of a friendly LLVM dev, the answer here is that this is not in fact a fatal error, after all!
The functions called above in the C interface are deprecated and should have been removed; LLVM used to have a notion of "global context", and that was removed years ago. The correct way to do this - so that this error can be caught and handled without aborting the process - is to use the LLVMDiagnosticInfo interface after creating an LLVMContext instance and using the context-specific bitcode reader functions:
void llvmDiagnosticHandler(LLVMDiagnosticInfoRef dir, void *p) {
fprintf(stderr, "LLVM Diagnostic: %s\n", LLVMGetDiagInfoDescription(dir));
}
...
LLVMContextRef llvmCtx = LLVMContextCreate();
LLVMContextSetDiagnosticHandler(llvmCtx, llvmDiagnosticHandler, NULL);
LLVMMemoryBufferRef mb = LLVMCreateMemoryBufferWithMemoryRange(somedata, data_length, "test", 0);
LLVMModuleRef module;
if (LLVMGetBitcodeModuleInContext2(llvmCtx, mb, &module) != 0) {
fprintf(stderr, "could not parse module bitcode");
}
The LLVMDiagnosticInfo also carries with it a "severity" code that indicates the seriousness of the error (sometimes mere warnings or perfomance hints are returned). Also, as I suspected, it is not the case that failing to parse bitcode invalidates the library or context state.
The code that was aborting with the cruddy error message was just a stop-gap to let legacy apps which still called the old API functions work - it set up a context and a minimal error handler which behaves in this way.
I have been getting a massive error recently, upon Running any of my flutter applications in Intellij, Visual Studio, etc. I cannot perform git functions because of it either. Any help would be greatly appreciated.
(Some parts omitted - this snippet represents the 40k line code pattern)
Launching lib/main.dart on iPhone X in debug mode...
compiler message:
file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/widgets/editable_text.dart:439:9: Error: Type 'LayerLink' not found.
compiler message: final LayerLink _layerLink = new LayerLink();
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:4474:20: Error: The method 'getLastTransform' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'getLastTransform'.
compiler message: return _layer?.getLastTransform() ?? new Matrix4.identity();
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:4501:18: Error: Method not found: 'FollowerLayer'.
compiler message: _layer = new FollowerLayer(
compiler message: ^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/texture.dart:76:7: Error: No named parameter with the name 'rect'.
compiler message: rect: new Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
compiler message: ^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:11: Error: 'ContainerLayer' isn't a type.
compiler message: final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message: ^^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:38: Error: Method not found: 'TransformLayer'.
compiler message: final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message: ^^^^^^^^^^^^^^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:124:38: Error: The method 'TransformLayer' isn't defined for the class '#lib1::RenderView'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'TransformLayer'.
compiler message: final ContainerLayer rootLayer = TransformLayer(transform: _rootTransform);
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:125:15: Error: The method 'attach' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'attach'.
compiler message: rootLayer.attach(this);
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:195:13: Error: The method 'addToScene' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'addToScene'.
compiler message: layer.addToScene(builder, Offset.zero);
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:215:58: Error: The method 'find' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'find'.
compiler message: final SystemUiOverlayStyle upperOverlayStyle = layer.find<SystemUiOverlayStyle>(top);
compiler message: ^
compiler message: file:///Users/JohnnySmithh/Documents/flutter/packages/flutter/lib/src/rendering/view.dart:220:35: Error: The method 'find' isn't defined for the class 'invalid-type'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'find'.
compiler message: lowerOverlayStyle = layer.find<SystemUiOverlayStyle>(bottom);
compiler message: ^
Compiler failed on /Users/JohnnySmithh/IdeaProjects/MyCoolProject/lib/main.dart
Error launching application on iPhone X.
Exited (sigterm)
It's honestly a little hard to tell what's going on from just that error message. Do any errors show up in intellij before you build?
The only things I can think of are:
your flutter installation might be corrupted. You could try deleting and re-installing
your build directory might have something wrong. Try running flutter clean before building again
your libraries aren't being included properly. I'd assume this would show up in intellij, but maybe the paths are set differently there? Check Project Structure -> Libraries and see where the paths are set there.
(related to first) you might have multiple instances of flutter on your computer. If intellij is using one while the command line is using another that could potentially cause problems.
If your app happens to be open-source, or you're able to make a new app with the minimum amount of changes to reproduce the error, that would help significantly with diagnosing the problem =).
My JNI code consists of calling some java functions (.jar file) from a C++ main.
The code compiles well, but during execution i get :
Segmentation fault (core dumped)
i ran GNU gdb to debug and i found the following during the call of this method :
if(mid != 0) {
doub = env->CallIntMethod(cls,mid,10);
Program received signal SIGSEGV, Segmentation fault.
0x00000000678856ed in jvm!JNI_GetCreatedJavaVMs ()
from /cygdrive/c/Program Files/Java/jdk1.8.0_05/jre/bin/server/jvm.dll
I also checked if the class is found (JNI FindClass function) and if the JVM is created (JNI_CreateJavaVM function) through the return value, and everything seems to be just fine.
At the end of the debugging the threads exit with code 35584 :
[Thread 4632.0x1304 exited with code 35584]
I didn't find anything about this value except that it implies a problem in the path to something required by the executable ... Any ideas about this ?
I specified the path for the .jar file as following :
char op[] = "-Djava.class.path=D:\\path\\tojar/MyJar.jar;D:\\path\\toclass";
options[0].optionString = op;
Thank you StackOverflowers :)
ps : if you think that posting the code can help please notify me in the comments !
CallIntMethod expects the first argument to be the receiver (i.e. this) object.
When the method you call is static, use CallStaticIntMethod.
I've written some code that dumps all ivars of a class into a dictionary in Objective C. This uses valueForKey: to get the data from the class. Sometimes, KVC throws an internal exception that is also captured properly - but this disrupts lldb's feature and all I get is:
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3)..
The process has been returned to the state before expression evaluation.
There are no breakpoints set. I even tried with -itrue -ufalse as expression options, but it doesn't make a difference. This totally defeats for what I want to use lldb for, and it seems like such a tiny issue. How can I bring clang to simply ignore if there are internal, captured ObjC exceptions while calling a method?
I tried this both from within Xcode, and directly via calling clang from the terminal and connecting to a remote debug server - no difference.
I ran into the same issue. My solution was to wrap a try/catch around it (I only use this code for debugging). See: DALIntrospection.m line #848
NSDictionary *DALPropertyNamesAndValuesMemoryAddressesForObject(NSObject *instance)
Or, if you're running on iOS 7, the private instance method _ivarDescription will print all the ivars for you (similar instance methods are _methodDescription and _shortMethodDescription).
I met the same problem.
My solution is simply alloc init the property before assigning it to the value which caused the crash.
Myself and coworkers ran into this today, and we eventually found a workaround using lldb's python API. The manual way is to run script, and enter:
options = lldb.SBExpressionOptions()
options.SetTrapExceptions(False)
print lldb.frame.EvaluateExpression('ThisThrowsAndCatches()', options).value
This could be packaged into its own command via command script add.
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3).. The process has been returned to the state before expression evaluation.
Note that lldb specifically points to the internal breakpoint -3 that caused the interruption.
To see the list of all internal breakpoints, run:
(lldb) breakpoint list --internal
...
Kind: ObjC exception
-3: Exception breakpoint (catch: off throw: on) using: name = 'objc_exception_throw', module = libobjc.A.dylib, locations = 1
-3.1: where = libobjc.A.dylib`objc_exception_throw, address = 0x00007ff81bd27be3, unresolved, hit count = 4
Internal breakpoints can be disabled like regular ones:
(lldb) breakpoint disable -3
1 breakpoints disabled.
In case lldb continues getting interrupted you might also need to disable the conditions of the breakpoint:
(lldb) breakpoint disable -3.*
1 breakpoints disabled.
In my particular case there were multiple exception breakpoints I had to disable before I finally got the expected result:
(lldb) breakpoint disable -4 -4.* -5 -5.*
6 breakpoints disabled.
I'm working to create bindings for Obj-C library so that I can work together with another team together on same project. To ensure this works, I'm attempting to create a simple obj-c library, define bindings, and use that object within MonoTouch. I have no build issue or even runtime exceptions, but my return value from calling any function is always null.
I started by created a new static library using Xcode and defined a 'Calculator' class. Below is the .h and .m
#interface Calculator : NSObject
- (NSString*)getMessage;
#end
#implementation Calculator
- (NSString*)getMessage
{
return #"hey, look at me!";
}
#end
This built into the file 'libXcodeLib.a'. I defined the following MonoTouch bindings for this class and methods:
[BaseType(typeof(NSObject))]
interface Calculator
{
[MonoTouch.Foundation.Export("getMessage")]
string GetMessage();
}
As well as an additional AssemblyInfo.cs for gcc_flags with the following:
[assembly: LinkWith ("libXcodeLib.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7, ForceLoad = true)]
And finally, here's a look at the Makefile used to produce the .dll file
BTOUCH=/Developer/MonoTouch/usr/bin/btouch
all: XcodeLib.dll
XcodeLib.dll: Makefile ApiDefinition.cs AssemblyInfo.cs libXcodeLib.a
$(BTOUCH) -e ApiDefinition.cs AssemblyInfo.cs --out=XcodeLib.dll --link-with=libXcodeLib.a,libXcodeLib.a
And here is sample code invoking this method:
var calc = new MTBindings.Calculator();
var msg = calc.GetMessage();
At this point, why is msg NULL?
From all the reading I've done, I cannot see what I'm missing to make this work. Any newer or proven samples/tutorials would be greatly appreciated, I'm not sure how to simplify this more - and yet it still doesn't work!
Thanks to the SO community - I hope :)
I reviewed the package from Matt, and what I found was that his library was an ARM-only library. When run in the simulator, the code would not be linked in, and Objective-C likes to silently continue execution when messages are sent to null objects.
This is what allows the following code in Objective-C to not crash:
id foo = null;
[foo.bar.baz saySomething:#"Hello"]
Despite foo being null. In this case, it came back to basically not say anything when the code failed to load the Calculator class. All the messages were being happily sent, but the Objective-C runtime just kept on going.