objective c - Automatic frameworks linking doesn't work -
today learned @import
statement can link frameworks automatically.
okay, created project, added webview
. throwing me error webview
undefined. okay, wrote @import webkit
— , error gone , webview
methods available me.
...i ran application , crashed with
*** terminating app due uncaught exception 'nsinvalidunarchiveoperationexception', reason: '*** -[nskeyedunarchiver decodeobjectforkey:]: cannot decode object of class (webview)'
then i've added webkit.framework
manually and... worked. what's point of @import
statement? automatic linking turned on...
import
imports headers. thus, name webview becomes defined, along methods , other stuff in webkit, , code can compile. linking links code - code in webview lives , breathes , has being - , code can run.
normally, if import framework using @import
, both things happen. can compile code because of import, , can run code in framework because import performs automatic linking.
but instantiating webview from nib. therefore have link explicitly or you'll crash when nib loads. same true if use mapview in nib — you'd need link mapkit explicitly or you'd crash when nib loads.
Comments
Post a Comment