I am using xCode 6. I am using a UIWebView. It is connecting to a link through NSURL. How do I make an error message that happens when the user is not connected to WiFi or internet? Thanks.
Never mind. I found a solution. In the .h file put a after the #interface, then in the .m file call a method in viewDidLoad that is webview.delegate=self.
Related
I am working on the ZBarReader and getting an error
Unknown class ZBarReaderView in Interface Builder file
[UIView setReaderDelegate:]: unrecognized selector sent to instance
0x6859f20
Please look at an attached image at here or below so that you can picture what I am doing so far :-
In the storyboard, I do have a view and its custom class is ZBarReadView. I also wire it with IBOutlet in header file. In m file, I do
viewReader.readerDelegate = self;
and the error is shown after right after that.
Can anybody please point out what I have screwed up....
I found the solution in a thread over here
You need to add the following code in your applicationDidLaunch in your AppDelegate:
// force view class to load so it may be referenced directly from NIB
[ZBarReaderView class];
Should be running fine after that.
you can also try to download 64bits ZbarSDK.
I think the solution should be to add -ObjC flag to "Other Linker Flags" section in your Build Settings. If you can't do this, e.g. you are using Parse Framework that doesn't allow you to set this flag, you will probably have to use the provided solution of Morothat: Set in your AppDelegate the following:
[YOURCLASSNAME class];
It looks like you actually added a view in interface builder and tried to call it a ZbarReaderView for IB to hook up. Correct me if I'm wrong but in this instance I don't think Ib is going to know what you mean by ZBarReaderView.
I'm Also assuming you haven't actually implemented the delegate method in your .m file.
I was parsing my xml in some other view controller's button click but now i have changed it to the app delegate class (My app is a Universal app). so that as soon as i start my app is should parse all.My parsing methods are written in another ViewController and i am calling those methods from my appDelegate class, but it is returning me this :-
NSXMLParser ERROR: The operation couldn’t be completed. (NSXMLParserErrorDomain error 65.) - (null)
dont know what i have done now. any help will be appreciable.
Refer the error code NSXMLParserSpaceRequiredError = 65 in NSXMLParser Class Reference.
Actually as it is a Domain error... it is not on your side. you must check your internet or Proxy settings. i hope you internet must be working on simulator but not in your app.... :)
Try it.
i have to write some code that initialize my data app. This must be made before the app the app is loaded. In my opinion the best way is to write this code in app delegate. Am i right?
p.s. : the code download some xml from the net and parse a lot of data and put in core data.
Depending on the exact context you can also implement a + (void)initialize method in your class.
YES friend if you write on applicationDidFinishLaunching method in appDelegate ..then webservice get called before the app launch and you have all that data when you start your application . for that you need to set connection by AsiHTTP connection DElegate and parse using NSXmlParserDelegate..
Yes , its right to call xml parsing in appdelegate so that you had data , before your app first view loads.
I am developing app with finding audio frequency by using FFT. In my app, I am not able to call application delegate method in app delegate class as given in below, but I could able to call other custom methods in app delegate class. What mistake I have done?
Please help me!
(void)applicationDidFinishLaunching:(UIApplication *)application
It looks like your project files have got a bit mixed up. To be honest, it's probably easier to start with a new application template as a base and then add your changes into it. If that is not possible, have a look at the following
In your {project_name}.plist file under the Resources folder you should see a setting
Main nib file base name
This will tell you which nib file is loaded at the start (normally MainWindow). Open this file and have a look for 'Files Owner' 'UIApplication'. Right click on this and there should be a link to the delegate. If it isn't there, then that's your problem
Check to make sure your application delegate inherits from NSObject and NOT NSApplication as NSApplication is a singleton. Otherwise your application object will be its own delegate.
You should now be using application:didFinishLaunchingWithOptions:
I've just finished off an app for the iPhone which, until today, ran fine on the iPhone simulator and actual devices.
I tried changing the xib which is loaded in the applicationDidFinishLaunching method in my application delegate class - all I did was change the string in initWithNibName.
When I launch the app on the simulator, the Default.png image is shown, then the app crashes with an uncaught exception. When running on a device, the Default.png image is shown for about 10 seconds, the UI is never loaded and I get 'GDB: Program received signal: "SIGABRT".' on the Xcode status bar. Debugging shows that applicationDidFinishLaunching is never actually reached before the app crashes.
Setting the starting xib back to the original solves the issue, but now I've made a change and saved it in the Interface Builder and the app shows the same issues as above - I've made no code changes at all.
Is this a memory issue, or a known issue of a common mistake?
NOTE: I've made no code changes whatsoever, and the only changes I've made to the xib are cosmetic, the IBOutlets are all intact.
You probably changed an IBOutlet's name in code without changing it in the xib.
Sorry guys, my fault - it appears I deleted the MainWindow.xib file, so the delegate wasn't called on startup after I made changes. I've recreated it and linked it to the app delegate and UIApplication so now everything works.
You probably had IBOutlets connected from a xib back into your code, and those connections are broken.
You'll have to give us a little more detail on how the nibname string was changed. Did you rename your xib file?
I renamed some classes and Xibs and got SIGABRT into main.m
the Class name in Identity Inspector may be pointing to non existant class name
its because in the initWithNibName you are not giving the correct xib name so it will crash