Post not yet marked as solved
I get the Admob ad unit ID and ad ID correct but I still got "invalid request. cannot determine request type. is your ad unit id correct?" and no ad displayed. Can anyone help me with that? Thanks
Post not yet marked as solved
I am building a table view app. There are names of some websites on the cells and the webpage of the websites are in detail page. The names and URLs of the websites are saved in Firebase Database. My question is, how to add the websites to the 'favorite"? In the 'favorite' page, I want to see the names on the cell, and the webpage in the detail page. How to make the 'Add to Favorite' button and how the datas are added to the favorite page? Anyone please help me? I will be so grateful if anyone help me with that. I am using Swift and Firebase. Thanks.
Post not yet marked as solved
I make an app with Fiebase and Swift. Firstly, I can upload the URL and the name of the website. Then the name will be displayed on the cell. When I click the cell, I can see the website page. My problem is when I click every cell, it is the same website. But the URL I uploaded to Firebase is different. Code in the website page: @IBOutlet weak var webView: UIWebView!
var web = [Web]()
var dataBaseRef: DatabaseReference! {
return Database.database().reference()
}
override func viewDidLoad() {
super.viewDidLoad()
dataBaseRef.child("webs").observe(.value, with: { (snapshot) in
var results = [Web]()
for user in snapshot.children {
let user = Web(snapshot: user as! DataSnapshot)
if user.webName != user.webUrl {
results.append(user)
let url = URL (string: user.webUrl as String)
let requestObj = URLRequest(url: url!)
self.webView.loadRequest(requestObj)
}
}
})
} Please help me to see what's the mistakes in the code. Thanks.
Post not yet marked as solved
I want to have a list of videos in my app. I want the videos to be related to art. But I don't want to add one by one. So, anyone have an idea how to embed them automatically with Youtube API. I am using Swift. Do you have the tutorials or sample codes. Please help me. Thanks
Post not yet marked as solved
I upload the data to the database successfully but I can't see the data in the cell of the list of the table view. I can't see even one cell. Please see my code of the table view controller : var tutsArray = [Tutorials]()
var userArray = [Users]()
var dataBaseRef: DatabaseReference! {
return Database.database().reference()
}
override func viewDidLoad() {
super.viewDidLoad()
let ref = Database.database().reference()
ref.observe(.value, with: { snapshot in
/
var newItems: [Tutorials] = []
/
for item in snapshot.children {
/
let tut = Tutorials(snapshot: item as! DataSnapshot)
newItems.append(tut)
}
/
self.tableView.reloadData()
})
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let ref = Database.database().reference()
ref.queryOrdered(byChild: "tuts").observe(.value, with: { snapshot in
/
var newItems: [Tutorials] = []
/
for item in snapshot.children {
/
let tut = Tutorials(snapshot: item as! DataSnapshot)
newItems.append(tut)
}
/
self.tableView.reloadData()
})
loadData()
}
func loadData() {
self.tutsArray.removeAll()
let ref = Database.database().reference()
ref.child("tut").observeSingleEvent(of: .value, with: { (snapshot) in
if let todoDict = snapshot.value as? [String:AnyObject] {
}
self.tableView.reloadData()
}) { (error) in
print(error.localizedDescription)
}
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
/
return self.tutsArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "sharesCell", for: indexPath) as! ArtTutsTableViewCell
/
/
cell.tutName?.text = tutsArray[indexPath.row].tutName
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
_ = self.tutsArray[indexPath.row]
let tutorialViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "idTutorialViewController") as! ArtTutsViewController
/
showDetailViewController(tutorialViewController, sender: self)
}
Post not yet marked as solved
When I want to upload something to the database but I got fatal error: unexpectedly found a nil while unwrapping an Optional value log. I found that currentUser = some but email, password, uid etc which are inside the currentUser are nil. I also found a EXC_BAD_INSTRUCTION herefunc savePost(){
var text: String!
if let postName = postName.text {
text = postName
}
// The EXC_BAD_INSTRUCTION on the line of code below
let newPost = Posts(postName: text, username: self.currentUser.username, postId: NSUUID().uuidString, postDate: (NSDate().timeIntervalSince1970 as NSNumber), postType: "TEXT", uid: self.currentUser.uid, tutUrl: url)
let postRef = self.dataBaseRef.child("tuts").childByAutoId()
postRef.setValue(newPost.toAnyObject(), withCompletionBlock: { (error, ref) in
/ if error == nil {
self.navigationController!.popToRootViewController(animated: true)
}else {
print(error!.localizedDescription)
}*/
})
}
I am using Firebase and Swift. Please help. Thanks
Post not yet marked as solved
I want to build this functionality. I want to make a table view and a list of websites name are on the table view and when you click the cell, it will bring you to the Detail page. In the Detail page, I want to make a web view that shows the website page. I want to store these websites name and url in the Firebase. How can I do it ? If you have sample code or this kind of tutorial, please it give me. Please do it as simple as possible. Thanks. I am using Swift and Xcode 9.
Post not yet marked as solved
I got Could not cast value of type 'NSNull'to 'NSDictionary' log and a Signal SIGABRT at the lineself.email = (snapshot.value! as! NSDictionary)["email"] as? Stringwhen I click the create account button and redirect me to a new page. This is the complete filestruct Users {
var username: String!
var email: String?
var country: String?
var photoURL: String!
var biography: String?
var uid: String!
var ref: DatabaseReference?
var key: String?
var firstLastName: String!
init(snapshot: DataSnapshot){
key = snapshot.key
ref = snapshot.ref
/
self.email = (snapshot.value! as! NSDictionary)["email"] as? String
self.username = (snapshot.value! as! NSDictionary)["username"] as! String
self.country = (snapshot.value! as! NSDictionary)["country"] as? String
self.uid = (snapshot.value! as! NSDictionary)["uid"] as! String
self.biography = (snapshot.value! as! NSDictionary)["biography"] as? String
self.photoURL = (snapshot.value! as! NSDictionary)["photoURL"] as! String
self.firstLastName = (snapshot.value! as! NSDictionary)["firstLastName"] as! String
}
Post not yet marked as solved
I got this when I run my app "EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)". See the code:@IBAction func signUpAction(_ sender: Any) {
let email = emailTextField.text!.lowercased()
let finalEmail = email.trimmingCharacters(in: .whitespacesAndNewlines)
let username = usernameTextField.text!
let password = passwordTextField.text!
let firstLastName = firstLastNameTextField.text!
let pictureData = UIImageJPEGRepresentation(self.userImageView.image!, 0.7)// Here
I cannot delete ! because if I do so I will get an error. For more info, this is my logs "fatal error: unexpectedly found nil while unwrapping an Optional value". Do anyone knows how to fix it? Please help me. Thanks.
Post not yet marked as solved
I run my app(the first page is CreateAccountViewController) and I got this logs2017-10-16 11:59:54.939874+0800 MyApp[7876:225869] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40003000 started2017-10-16 11:59:54.941076+0800 MyApp[7876:225869] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http:/ 2017-10-16 11:59:55.184432+0800 MyApp[7876:225749] [MC] Loaded MobileCoreServices.framework2017-10-16 11:59:55.608120+0800 MyApp[7876:225877] Could not successfully update network info during initialization.2017-10-16 11:59:55.671035+0800 MyApp[7876:225877] TIC Read Status [1:0x0]: 1:572017-10-16 11:59:55.671236+0800 MyApp[7876:225877] TIC Read Status [1:0x0]: 1:57Then, there are three text fields on the page, Password, Email and Username and an image view. When I click SignUp button this two lines of logs are addedfatal error: unexpectedly found nil while unwrapping an Optional value2017-10-16 12:00:03.364552+0800 MyApp[7876:225749] fatal error: unexpectedly found nil while unwrapping an Optional value(lldb)And the button disabled and whole screen stuck. What is happening? Anyone knows the solutions? I am using Firebase. Please help me . Thanks
Post not yet marked as solved
When I run my app on Simulator, the Simulator stuck at the screen which is black with a white Apple logo at the center. I have this problem when I use Xcode 8, there is no problem in Xcode 7. Please help me. Thanks
Post not yet marked as solved
How to make a blogging app like Wordpress for iPhone? I want the user to write and read blogs in my app. I am using Firebase and I wish to use Firebase to store the blogs. Do anyone find this type of tutorials? If yes, please give me the link. If you know how to build it , please help me. I am using Swift. Thank you very much.
Post not yet marked as solved
I got 'Linker Command Failed with Exit Code (use -v to see invocations) 'error. And I found "ld: framework not found Firebase". I added $PROJECT_DIR/Pods and made it recursive. But I got the error again, but now it is "ld: framework not found Firebase". I tried to delete the DerivedData, but when I run the app, the DerivedData regenerated. I get stuck with this issue for few days. Please help me. Thanks
Post not yet marked as solved
I got this error 'Cannot call value of non-function type 'module<Firebase>'' The code is copied from a tutorial sample project. But no errors in the sample project. Thesample project moved from Xcode 7 to 8 and I had chaged the syntax before copy. What is my problem? I will be very appreciate if anyone helped my. Thanksfileprivate var _BASE_REF = Firebase(url: "\(BASE_URL)")//error here
fileprivate var _USER_REF = Firebase(url: "\(BASE_URL)/users")//error here
fileprivate var _JOKE_REF = Firebase(url: "\(BASE_URL)/jokes")//error here
var BASE_REF: Firebase {// another error: Use of undeclared identifier type 'Firebase'
return _BASE_REF!
}
var USER_REF: Firebase {// another error: Use of undeclared identifier type 'Firebase'
return _USER_REF!
}
var CURRENT_USER_REF: Firebase {// another error: Use of undeclared identifier type 'Firebase'
let userID = UserDefaults.standard.value(forKey: "uid") as! String
let currentUser = Firebase(url: "\(BASE_REF)").child(byAppendingPath: "users").child(byAppendingPath: userID)
return currentUser!
}
var JOKE_REF: Firebase {// another error: Use of undeclared identifier type 'Firebase'
return _JOKE_REF!
}
Post not yet marked as solved
I got 'Command /usr/bin/ditto failed with exit code 1' error. I installed Firebase. I also got the 'Linker command Failed with exit code 1' Please help Thanks