How to use UIGetScreenImage - iphone

I would like to be able to do a real time analysis of the image taken by the camera.
I've seen that we are now allowed to use the undocumented UIGetScreenImage function.
However, I do not succeed to use it, I have the following warning:
implicit declaration of function 'UIGetScreenImage'
any idea to solve this?
Thanks in advance!
regards,

You need to put a prototype
CGImageRef UIGetScreenImage(void);
in your source code (or some common headers).
Note that you need to CGImageRelease the result of UIGetScreenImage even it is a "Get" function.

Related

function countByExample mybatis-generator help me

I have a problem, in my picture. I use mybatis and countByExample method was generated by MyBatis Generator. Can u help me and see it?
https://i.stack.imgur.com/e3arE.png
https://i.stack.imgur.com/WOp1f.png
It looks like you are reusing jobCtrlExample between method calls. if you do that, then you need to clear the previous conditions before you set new conditions. Probably adding this line will fix it:
jobCtrlExample.clear();
It would be better to create a new example class for every method.

Swift 3 (Omit Needless Words) causing two functions to have the same name

In Swift 3.0, the automated changing of function names due to the "Omit Needless Words" rule has caused two functions in an ObjC class to be the same.
- (void)showLoader;
...and...
- (void)show __deprecated_msg("User 'showLoader'");
The problem is that these functions are within a third party Cocoa Pod (otherwise I would just delete the unnecessary 'show' function).
This results in getting the error "Ambiguous use of 'show'" when I try to invoke the function like this:
loader?.show()
Is there a way to reverse the automatic changing of function name in Swift 3.0 or to help the compiler know which function I want to invoke?
Thanks for your help!
See MartinR's answer to my similar question here: Converting to Swift 3 renamed my own Objective-C method
If you owned the code, you could use NS_SWIFT_NAME(showLoader()) after your method declaration to force the ObjC-to-Swift method conversion to be named what you want:
- (void)showLoader NS_SWIFT_NAME(showLoader());
I think it's worth mentioning even though in your case it doesn't exactly solve your problem because you don't own the code.
You can work around this by calling
loader?.perform(Selector("showLoader"))
You will see a warning from the compiler, but it will compile successfully, and things will work correctly at runtime.

Using boost's socket.async_send_to()

I've been stuck on this for a while now. I am trying to send the following:
boost::shared_ptr<uint8_t[]> m_data
over the wire using:
_socket.async_send_to(boost::asio::buffer(m_data), m_remote_endpoint,
boost::bind(&UDPServer::handle_send, this, message,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
I get the error "no instance of overloaded function boost::asio::buffer matches the argument list boost::shared_ptr<uint8_t[]>"
m_data is filled in another function.
I suspect this is because I actually have to use the key word new on m_data. But I can't quite figure out how to do it. I've tried a few different variations. Can anybody offer me some insight here? This is probably more a question of how to dereference a shared pointer then anything. Thanks in advance!
boost::asio::buffer has an impressive lists of consttructors, but neither of them takes shared_ptr<[]> (possibly an oversight form lib authors).
In your case, you simply need to derefence shared ptr, for example, by calling get on it.

OpenAL/ALUT - Loading wav files

I'm using the following function:
_alutLoadWAVMemory_((ALbyte *)myBuf,&format, &data, &size, &freq, &loop);
I have 2 questions:
I've read online that the function is deprecated, does anyone know why? More important - what should I use instead?
Is the variable format assigned with data regarding the format after I call _alutLoadWAVMemory_?
Thanks a lot!
There are a few candidates for functions to use instead, see the Alut documentation on loading. I think the closest equivalent to LoadWAVMemory would be 'alutCreateBufferFromFileImage'.

How to use CTTypesetterSuggestClusterBreak in Core Text

I am having trouble in using CTTypesetterSuggestClusterBreak function of CTTypeSetterRef class. I want to use this method to get closest word boundry near an index. I am having difficult in the implementationof this method, i.e how and where this method must be used.
I have been banging my head over this but with no success yet. If anyone can help me in using this method I would be very greatful.
Thanx in advance
I'm not sure CoreText is appropriate for this task; it sounds like you should investigate CFStringTokenizer instead.