UIStackView has no member delegate error in Swift - ios

I'm learning how to program in Swift.
At one step in the iOS Developer Library
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson3.html#//apple_ref/doc/uid/TP40015214-CH22-SW1
it tells me to add the command:
nameTextField.delegate = self
After entering the Command a Error pops up saying:
Value of type 'UIStackView' has no Member 'delegate'
Please someone have a solution?
Thank you in advance.

You should try adding the UITextFieldDelegate protocol.

Related

Xcode error - use of undeclared identifier 'GAdInterstitialKey_Live'

When I'm trying to build this project in Xcode8 I get this error
use of undeclared identifier 'GAdInterstitialKey_Live'
on this line
interstitial = [[GADInterstitial alloc] initWithAdUnitID:GAdInterstitialKey_Live];
Do you have that string in some part of your code? By the way, are you using admob? Interstitial might be related to it.
Assuming you are using something like admob you have to define keys provided by the service to relate the user to your app. You might not have defined then or dit it in a wrong way.

Use of unresolved identifier - app development with Swift Project 2

Sorry - I realise this is a complete beginner question, but I've googled for half a day now and still can't resolve the issue myself.
I'm using xCode 8.3 and trying to complete the apple - app development with swift course - end of unit project 2. I'm told (by the Apple book) I should be able to run the app without build failures, even if it isn't finished.
I get an unresolved identifier error when I add the following code to my ViewControler file, inside the class ViewController: UIViewController.
func updateUI() {
correctWordLabel.text = game.formattedWord
scoreLabel.text = "Wins: \(totalWins), Losses: \(totalLosses)"
treeImageView.image = UIImage(named: "Tree \(currentGame.incorrectMovesRemaining)")
}
xCode suggests I change it to Game.formattedWord, but when i do get 'Instance member 'formattedWord' cannot be used on type 'Game' ViewController.Swift'.
Could someone please help?
I've checked the sample code from Apple about 100 times and they are def saying it should be game.formattedWord in the code.
Thank you!
Try correctWordLabel.text = currentGame.formattedWord
I think it’s a typo.
Earlier in your code you create an instance of the Game struct called currentGame so you are accessing the formattedWord variable inside that instance. That’s why you couldn’t change it to Game. Game is like the blueprint of the struct. currentGame is your actual ‘thing’ Hope that makes some sense.

I am receiving a "cannot initialize a parameter of type" error with theos

I am getting this error while trying to compile a those project. The error is
"Tweak.xm:37:21: error: cannot initialize a parameter of type 'UIView
* _Nonnull' with an
lvalue of type 'UITapGestureRecognizer *' [content addSubview:singleTap];"
this is the image of my error link
About your comment on alexander-li's answer, just add this line in your Makefile :
TweakName_FRAMEWORKS = UIKit
and add #import <UIKit/UIKit.h> to your Tweak.xm file.
And please, just learn how to code before launching yourself in Theos development. It's not the easiest environment but there are a lot of pages who can help you.
You are using a UITapGestureRecognizer as a UIView parameter.
If you are trying to add a gesture recognizer,
[content addGestureRecognizer:singleTap];
If you are trying to add a subview, you need to initialize a UIView object or a subclass of it. However, it seems you are trying to add a gesture recognizer.

Box iOS SDK - Receiver 'BoxSearchRequestBuilder' for class message is a forward declaration

I am trying to use the BoxSearchRequestBuilder class to be able to perform a search in Box via the iOS SDK (v2). When I try to instantiate a BoxSearchRequestBuilder instance with its initializer, I get a compiler error.
What I am trying to do:
BoxSearchRequestBuilder* builder = [[BoxSearchRequestBuilder alloc] initWithSearch:#"123" queryStringParameters:#{#"content_types" : #"tags"}];
The error:
receiver 'BoxSearchRequestBuilder' for class message is a forward declaration or
receiver type 'BoxSearchRequestBuilder' for instance message is a forward declaration.
Basically the BoxSearchRequestBuilder class is declared via a forward declaration (#BoxSearchRequestBuilder), so I cannot directly access its properties/initializers.
I can fix the error by going to the iOS SDK class BoxSearchResourceManager and changing the forward declaration to an import statement:
#import "BoxSearchRequestBuilder.h"
//#class BoxSearchRequestBuilder;
However, I don't think I should be doing this. Are there any other alternatives? The rest of the API works fine.
Thanks for flagging this.
It has been fixed thanks to your feedback in this change:
https://github.com/box/box-ios-sdk-v2/commit/67064ea1f0c1aff040fba1e249b9f550281c01e2
feel free to file issues on SDK github page.

iOS swift GKSession usage

I'd like to use GKSession in one of my swift file. But there is a problem to do so. Here is the error message:
/Users/Desktop/Snap/Snap/MatchmakingServer.swift:15:1: Type
'MatchmakingServer' does not conform to protocol 'NSObjectProtocol'
Here is my code:
class MatchmakingServer : GKSessionDelegate {
I have no idea what does this mean and how to solve the issue. Can anybody help? Thanks

Resources