ios


obejective c - Portential leak of an object stored into


I am trying to Run the code but its reporting the memory leaks when using static analyzer. on this line as Potential leak of an object stored into 'encodedData'
return encodedData;
use __bridge_transfer
Using __bridge_transfer ensures that ARC will release the object for you. Without __bridge_transfer, you must release the returned object manually.
__bridge,__bridge_transfer keywords are used to tell to ARC system how to handle your non-objective-c pointers. In essence, if you use __bridge, you are telling to ARC not to deal with the ownership of the converted pointer because you will free it from non-objective-c code, most likely with a free() or a CFRelease... type function. __bridge_transfer, on the other hand, transfers the ownership to ARC and ARC will free your objective-c (and thus also the original non-objective-c) object via the standard release mechanism when the references to that object hits zero.
Reference
The problem is that you create your string using CoreFoundation methods. And by default ARC doesn't know what to do with it. So, you're responsible for either manually managing the memory for the created object (using CFRelease for example), or handing it over to ARC.
The later is, I believe, the way to go in your case. You can do it, as others have already noted, using __bridge_transfer.

Related Links

Is it useful to create two concurrent queues in IOS?
How to pre-fill email account in google-oauth2 for iOS API
Twitter search api text field value is truncated
How to install root certificate inside iOS app, so it will be trusted when open URL from UIWebView?
JSon and Ambiguos use of subscript
get remote push notification message in background in iOS
Why can't I bold just part of a string in Swift with NSMutableString?
Swift - WebView doesn't detect swipes when loading
Interstitial DFP ad doesn't fill the screen
Q:UITableView scrollview delegate method did not pass the special code
ios Xcode storyboard compact not working
iOS - Where is object stored in application NSUserDefault? [duplicate]
UIImage to NSData fatal error: unexpectedly found nil while unwrapping an Optional value
How to load images for UITableView or UICollectionView from cache everytime
iOS - UITableview cells with shared surface
Xcode fix memory problems

Categories

HOME
dynamic-programming
f#
ffmpeg
demandware
logstash
collections
coffeescript
vr
xaml
azure-web-sites
saml
robot
arm
eps
superfish
frequency
sparkpost
editor
cloudrail
amadeus
silk-performer
exe4j
beanstalkd
man
urlrewriter.net
cadvisor
smallbasic
azure-redis-cache
jtable
physics
flexjs
angular-ngmodel
flatbuffers
valueinjecter
ocean
gcp
instance
panel-data
evercookie
azure-api-apps
svgpanzoom
cloudinary
groove
macvim
qweb
visualsvn-server
phasset
hostapd
dependency-management
arm7
wrk
formstack
sharpziplib
tpl-dataflow
kony
fasta
untagged
glumpy
assembly-references
android-camera-intent
callkit
geneticsharp
plotrix
sqlite-net
django-errors
vispy
evaluate
xceed
xendesktop
webpagetest
telecommunication
file-management
cufft
menustrip
strace
cucumber-java
mysqladmin
samsung-gear
nbug
node-orm2
pegkit
google-swiffy
theorem-proving
excel-charts
concurrentdictionary
notifydatasetchanged
image-scaling
pkcs#10
short
nine-patch
delphi-2009
pydatalog
transport-stream
gora
polarssl
hudson-plugins
eject
blackberry-cascades
oncreate
arr
sticky-footer
ccr
j#
nsinvocation
closest
machine.config
noaa
n900
network-scan
68hc11
sharepoint-feature

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App