본문 바로가기

나의 플랫폼/iOS

[iOS] Error: Could not build Objective-C module 'Firebase' Push Notification 기능을 이용하기 위해 Firebase Cloud Messaging 기능을 많이 이용 할 것이다.Firebase에서 알려준 방식으로 하다가.. Firebase가 import 안되는 현상이 발생 했다. Firebase 설정 : https://firebase.google.com/docs/cloud-messaging/ios/client?hl=ko 멍미?? 오류는 아래와 같이 발생 했다.여러 구글링을 한 결과... CoCoaPods를 다시 받으면 된다고 한다. 아래와 같이 해보아라.1. 먼저, CoCoaPods temp 파일 제거를 위치 경로를 연다.Xcode -> Preference... 실행 Locations 탭 클릭 후, 아래 화면에서 빨간 상자 부분 클릭 DerivedDat.. 더보기
[iOS] Error ITMS-90717: “Invalid App Store Icon” Xcode 9.0으로 업데이트 하고 나서, AppIcon에 아래와 같이 1024 x 1024 크기가 생겼다. 머~ 간단하게 1024 x 1024 크기로 아이콘을 만들고 설정 한 후,iTunes Connect에 업로드를 진행 했는데... 갑자기 아래와 같은 에러가 발생 한다. 이게 멍미!!! 문구를 읽어보면... AppStore Icon은 alpha channel을 넣지 말라고 하는 거다. 그럼 어떻게 하면 될까?? 1024 x 1024 이미지를 jpg나 알파 채널을 제외 시킨 png로 바꾸면 된다. Alpha channel을 없애는 방법은 아래 와 같이 하면 된다. 1. 이미지를 클릭 한 후, 'Show in Finder' 메뉴를 선택 한다. 2. 이미지 Preview를 실행 하고 '파일' -> '보내기.. 더보기
[iOS] Self-sizing TableView Cell TableView 안에 여러 동적인 뷰가 들어갈 경우가 많이 있다.그럴 경우 View 하나하나 Height 값을 가져 와서 임의로 Cell Height를 정하시는 분들이 있다. 그러면 추후 유지보수하는데 너무 어려움을 많이 느끼게 된다. (보기에도 좋지 않음) 그래서 레이아웃을 되도록 AutoLayout으로 구성한 다음,아래와 같이 TableView에 설정을 추가해 주자. 12tableView.estimatedRowHeight = 225.0tableView.rowHeight = UITableViewAutomaticDimensioncs estimatedRowHeight는 임의로 설정해놓는 값이고,rowHeight를 UITableViewAutomaticDiemension 으로 설정하면Autolayout 설정.. 더보기
[iOS] UITableView scroll to top UITableView이 Scroll을 최상위로 옮길 때 아래와 같은 소스 형태로 많이 할 것이다. 12let indexPath = IndexPath(row: 0, section: 0)self.tableView.scrollToRow(at: indexPath, at: .top, animated: false)cs 하지만, 저 같은 경우 가끔 TableView 첫번째 Cell만 정상 동작을 하지 않는 경우가 발생 하더라구요.갱신이 안되는 가장 많이 발생 했었습니다. 그래서, 여러 테스트를 해본 결과 아래 형태로 하면 해결 되더라구요. 12let indexPath = NSIndexPath(row: NSNotFound, section: 0)self.tableView.scrollToRow(at: indexPath a.. 더보기
[iOS] change TableHeaderView height dynamically with autolayout TableHeaderView에 높이가 바뀌었을 경우 해당 뷰 높이를 갱신 하더라도 TableHeaderView의 영역이 변하지 않아 어려움을 겪으신 분들은 아래 소스를 참조해보세요. 123456789101112if let headerView = tableView.tableHeaderView { let height = headerView.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height var headerFrame = headerView.frame //Comparison necessary to avoid infinite loop if height != headerFrame.size.height { headerFrame.size.height = h.. 더보기
[iOS] initWithCoder unrecognized selector sent to instance Model을 만들어 사용할 때 아래 와 같은 에러가 나올 경우, [ModelVO initWithCoder:]: unrecognized selector sent to instance 한번 에러 나는 모델 소스가 아래와 같이 되어 있는지 확인 바란다. 12345678910111213141516171819202122232425import Foundation class ModelVO : NSObject { var num: Int var title: String init(qno: Int, question: String, answered: Int){ self.num = qno self.title = question self.answered = answered } required init(coder aDecoder:.. 더보기
[iOS] LocalNotification ## LocalNotification 설정 iOS 10 버전 이상 부터 UNUserNotificationCenter를 사용할 수 있다.우선 아래와 같이 UserNotifications를 import 시켜야 사용이 가능 합니다. 1234import UserNotificationsimport UIKit class ViewController: UIViewController ,UNUserNotificationCenterDelegate{cs 사용은 아래 와 같이 iOS 10 이상일 경우는 UNUserNotificationCenter를 사용하고, 그렇지 않을 경우는 기존 사용 되던 UILocalNotification을 사용하면 됩니다. 12345678910111213141516171819202122232425262.. 더보기
[iOS] Swift defer 블록 defer 블록 : 메소드 에서 코드의 흐름과 상관 없이 가장 마지막에 실행되는 블록 SQLite3를 사용할 때 참고 하면 좋을 듯 하다. func dbExecute(dbPath: String) { // 1 var db: OpaquePointer? = nil guard sqlite3_open(dbPath, &db) == SQLITE_OK else { print("Database Connect Fail") return } // 2 defer { print("Close Database Connection") sqlite3_close(db) } // 3 var stmt: OpaquePointer? = nil let sql = "create table if not exists sequence (num integ.. 더보기