<div dir="ltr"><div>Hi,<br><br>Our project is using JavaScriptCore to drive
application logic and creation of native UIView hierarchies. A typical
use case will involve an Objective-C class that exposes a number of
methods and properties to JSCore. From the JavaScript side, we create an
JSValue object wrapping an instance of the Objective-C object, and once
we are done we remove all references to it. <br><br>One problem we are
running into is that the deallocation of the Objective-C object seems
unpredictable, meaning that sometimes the dealloc() method of said
object is invoked immediately, but sometimes it takes up to a couple of
minutes before it would be called. To illustrate the issue, I created
and attached to this email a simple Xcode project. When you run the
project and click the 'Run Script' button (one or multiple times), you
can watch the Xcode debug console for relevant logs and observe when
"Person dealloc - name is bill" would appear. And btw, my tests were
done in Xcode 7 with iPhone 6 (iOS 9) simulator. <br clear="all"><div><br></div>So
my question is: what I need to do to make sure the my Objective-C
object's dealloc() is called immediately as soon as my JavaScript code
removes all references to the object? <br clear="all"><br></div>Thanks in advance,<br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>- Yadong<br>Sr. Mobile Engineer<br>Fingerprint Digital Inc.<br><a href="http://www.fingerprintplay.com" target="_blank">http://www.fingerprintplay.com</a><br>1-855-KID-GAME<br><br><span style="background-color:rgb(255,0,0)"><span style="color:rgb(255,0,0)"><b><span style="background-color:rgb(255,255,255)"><a href="http://www.prnewswire.com/news-releases/samsung-and-fingerprint-partner-to-create-mobile-play-and-learn-network-for-kids-companies-launch-initiative-to-drive-app-development-234570981.html" target="_blank">News: Samsung and Fingerprint Announce Kids Mobile Play and Learn Network </a></span></b></span></span><br>
<br><font>Check out our latest apps at </font><font><a href="http://www.fingerprintplay.com/" target="_blank"><span></span></a><font color="#888888"><a href="https://itunes.apple.com/us/artist/fingerprint/id473099999" style="color:rgb(17,85,204)" target="_blank">https://itunes.apple.com/us/artist/fingerprint/id473099999</a></font></font>
<font><br>Like us on Facebook at <a href="https://www.facebook.com/FingerprintPlay" target="_blank">https://www.facebook.com/FingerprintPlay</a></font><br></div></div></div>
</div>