Questions tagged [nsobjectprotocol]
9 questions
27
votes
3 answers
Type CCC doesnt conform to protocol 'NSObjectProtocol'
I don't understand why my code doesn't work. Here it is:
class Test: NSURLSessionDataDelegate {
func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) {
if(error == nil) {
…

emoleumassi
- 4,881
- 13
- 67
- 93
2
votes
2 answers
Swift class/struct implicitly conforms to NSObjectProtocol?
A while ago I faced strange Swift issue. When I try to cast Swift object to NSObjectProtocol in debug - it executes successfully. But when this code executes in AppStore build, it casts to nil.
import Foundation
final class MyClass {
let testP:…

Dmitriy Stupivtsev
- 832
- 1
- 8
- 17
1
vote
1 answer
Objective-C: declaring @protocol generates error Illegal interface qualifier
I'm trying to implement a @protocol/delegate but I'm getting this error:
Illegal interface qualifier
Here is my code:
//
// MyProtocol.m
// Apple-ObjC
//
//
#import
@interface MyProtoco : NSObject
@protocol…

user2924482
- 8,380
- 23
- 89
- 173
1
vote
1 answer
Why does a class become public if you inherit from NSObject in Swift?
I'm working on a framework.
The library is written in Swift and I notice that when a class inherits from NSObject or conforms to NSObjectProtocol, its declaration can be found in *.framework/Headers/*-Swift.h.
This class is available outside of…

user3158880
- 21
- 4
1
vote
1 answer
Trying to subclass GADRewardBasedVideoAdDelegate on Swift
I am trying to create a singleton class, subclass of GADRewardBasedVideoAdDelegate. Something like this:
import Foundation
import GoogleMobileAds
class MyAdsManager : GADRewardBasedVideoAdDelegate {
private let id : String = "MY_ADMOB_ID"
…

Amg91
- 165
- 8
- 25
0
votes
0 answers
Can you insert strings or other data into an empty class instance property whom’s data type is the same as the data that you’re trying to add? Swift
I’m trying to manipulate some business hours info for a business that was originally gotten from an API, and am trying to insert strings into an empty class instance property whom’s data type is the same as the data that I’m trying to add (a…

coder
- 19
- 4
0
votes
0 answers
NotificationCenter.default.addObserver(forName:object:queue:using:) documentation about the object returned
What is exactly created in this function?
I'm trying to create a reusable extension so that every UIViewController can hold a reference to the NSObjectProtocol observer that's returned in this function. The observer doesn't seem to be the object…

Huy-Anh Hoang
- 777
- 6
- 24
0
votes
1 answer
An application crashes in case of working with MFMailComposeViewController
I am doing a screen that allows users to send mail. I wrote some code for it and it works fine:
import UIKit
import MessageUI
class ViewController: UIViewController, MFMailComposeViewControllerDelegate {
override func viewDidAppear(_ animated:…

Sergey Polozov
- 225
- 1
- 11
0
votes
1 answer
Viewcontroller not conforming NSObject protocol
I'm working on a app that was doing great so far.
But today, maybe after some twinkering to try to implement a WatchOsKit, my viewcontroller seems to be broken.
Xcode is telling me that it's not conforming to the NSObject Protocol and that a bunch…

Nicolas Kalogeropoulos
- 217
- 2
- 3
- 16