Cov txheej txheem:
- Kauj Ruam 1: Nruab Qhov Yuav Tsum Tau Ua
- Kauj ruam 2: Teeb Project
- Kauj ruam 3: Sau IOS Code
- Kauj Ruam 4: Tsim Tus Neeg Siv Kev Sib Tham
- Kauj Ruam 5: Sau Huab Huab
- Kauj ruam 6: Khiav lub App
Video: Kev sib thooj Duab Sib Koom IOS App: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Hauv cov lus qhia no peb yuav tsim iOS app nrog Swift uas tso cai rau koj qhia cov duab nrog txhua tus neeg nyob ze, tsis tas yuav siv lub cuab yeej txuas ua ke.
Peb yuav siv Chirp Txuas xa cov ntaub ntawv siv suab, thiab Firebase khaws cov duab hauv huab.
Kev xa cov ntaub ntawv nrog lub suab tsim qhov kev paub tshwj xeeb uas cov ntaub ntawv tuaj yeem tshaj tawm rau txhua tus neeg hauv thaj tsam hnov lus.
Kauj Ruam 1: Nruab Qhov Yuav Tsum Tau Ua
Xcode
Nruab los ntawm App Store.
CocoaPods
sudo lub pov haum nruab cocoapods
Chirp Txuas iOS SDK
Sau npe ntawm admin.chirp.io
Kauj ruam 2: Teeb Project
1. Tsim qhov project Xcode.
2. Kos npe rau hauv Firebase thiab tsim txoj haujlwm tshiab.
Pab kom Firestore los ntawm txhaj rau ntu Database thiab xaiv Cloud Firestore. Nyem rau hauv Kev Ua Haujlwm kuj tseem tuaj yeem pab ua haujlwm huab.
3. Khiav los ntawm teeb tsa koj li iOS app ntawm nplooj ntawv Txheej txheem cej luam
Koj yuav xav tau Cov Ntawv Qhia Tus Kheej los ntawm General Tab hauv koj li Xcode Project Settings. Thaum lub Podfile tau tsim los koj yuav xav tau ntxiv cov kev vam khom hauv qab no, ua ntej yuav nruab pod.
# Pods rau qhov project
pod 'Firebase/Core' pod 'Firebase/Firestore' pod 'Firebase/Cia'
4. Rub tawm qhov tseeb Chirp Txuas iOS SDK los ntawm admin.chirp.io/downloads
5. Ua raws cov kauj ruam ntawm developers.chirp.io los koom ua ke Chirp Txuas rau Xcode.
Mus rau Pib Pib / iOS. Tom qab ntawv nqes mus thiab ua raws Swift teeb tsa cov lus qhia qhov no yuav koom nrog kev nkag mus rau lub moj khaum thiab tsim txoj kab txuas txuas.
Tam sim no teeb tsa tiav, peb tuaj yeem pib sau qee qhov chaws! Nws yog lub tswv yim zoo los tshuaj xyuas koj txoj haujlwm tsim ntawm txhua theem hauv kev teeb tsa.
Kauj ruam 3: Sau IOS Code
1. Ntshuam Firebase rau hauv koj tus ViewController thiab txuas ntxiv NSData kom suav nrog hexString txuas ntxiv, yog li peb tuaj yeem hloov Chirp Txuas cov nyiaj them poob haujlwm rau txoj hlua hexadecimal. (Chirp Txuas yuav muaj nyob thoob plaws ntiaj teb ua tsaug rau qhov txuas txuas lub taub hau).
ntshuam UIKit
ntshuam Firebase
Cov ntaub ntawv txuas ntxiv {
var hexString: Txoj hlua {xa daim duab qhia chaw {Txoj hlua (hom ntawv: "%02x", UInt8 ($ 0)))}.joined ()}}
2. Ntxiv ImagePicker cov neeg sawv cev rau koj tus ViewController, thiab tshaj tawm ChirpConnect qhov sib txawv hu ua txuas.
chav ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var txuas: ChirpConnect? override func viewDidLoad () {super.viewDidLoad ()…
3. Tom qab super.viewDidLoad, pib Chirp Txuas, thiab teeb tsa qhov tau txais rov qab. Hauv qhov tau txais kev hu rov qab peb yuav khaws cov duab los ntawm Firebase siv cov nyiaj tau txais thiab hloov kho ImageView. Koj tuaj yeem tau txais koj li APP_KEY thiab APP_SECRET los ntawm admin.chirp.io.
txuas = ChirpConnect (appKey: APP_KEY, thiabSecret: APP_SECRET) yog tias cia txuas = txuas {connect.getLicenceString {(daim ntawv tso cai: hlua?, yuam kev: Yuam kev?) hauv yog yuam kev == nil {yog tias tso cai = tso cai {txuas.setLicenceString (daim ntawv tso cai) txuas.start () txuas.receivedBlock = {(cov ntaub ntawv: Cov ntaub ntawv?) -> () hauv yog tias cia cov ntaub ntawv = cov ntaub ntawv {luam tawm (Txoj hlua (hom ntawv: "Tau txais cov ntaub ntawv: %@", data.hexString)) cia cov ntawv = Storage.storage (). Reference (). Child (data.hexString) file.getData (maxSize: 1 * 1024 * 2048) {imageData, yuam kev yog tias cia yuam kev = yuam kev {print ("Yuam kev: %@", yuam kev.localizedDescription)} else {self.imageView.image = UIImage (data: imageData!)}}} else {print ("Decode failed"); }}}}
4. Tam sim no ntxiv cov cai kom xa cov ntaub ntawv duab ib zaug nws tau raug xaiv hauv UI.
func imagePickerController (_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String: Any])
{cia imageData = info [UIImagePickerControllerOriginalImage] li? UIImage cia cov ntaub ntawv: Cov ntaub ntawv = UIImageJPEGRepresentation (imageData !, 0.1)! self.imageView.image = imageData cia metadata = StorageMetadata () metadata.contentType = "duab/jpeg" yog tias cia txuas = txuas {txuas qhov tseem ceeb: Cov ntaub ntawv = txuas.randomPayload (nrogLength: 8) Firestore.firestore (). sau (". uploads "). addDocument (cov ntaub ntawv: [" qhov tseem ceeb ": key.hexString," timestamp ": FieldValue.serverTimestamp ()]) {yuam kev hauv yog tias ua yuam kev = yuam kev {luam tawm (error.localizedDescription)}} Storage.storage ().reference (). tus menyuam (key.hexString).putData (cov ntaub ntawv, metadata: metadata) {(metadata, yuam kev) hauv yog tias cia yuam kev = yuam kev {luam tawm (error.localizedDescription)} lwm yam {connect.send (qhov tseem ceeb)}} } self.dismiss (animated: tseeb, tiav: nil)}
Nco tseg: Koj yuav tsum tau ntxiv Tus Kheej - Cov Tsev Qiv Ntawv Siv Cov Lus Qhia, Tsis Pub Leej Twg Paub - Kev Siv Lub Tsev Qiv Ntawv Qhia thiab Tsis Pub Leej Twg Paub - Microphone Siv Cov Lus Qhia nqe lus rau koj Info.plist kom tso cai siv lub Koob Yees Duab, Lub Tsev Qiv Duab thiab Microphone.
Kauj Ruam 4: Tsim Tus Neeg Siv Kev Sib Tham
Tam sim no mus rau Main.storyboard cov ntaub ntawv los tsim UI.
1. Luag hla ib qho ImageView thiab ob lub khawm mus rau Storyboard los ntawm Lub Tsev Qiv Ntawv Vaj Huam Sib Luag nyob hauv qab txoj cai kaum.
2. Rau txhua lub khawm ntxiv qhov siab txwv txog 75px los ntawm kev xaiv cov khoom siv thiab nyem rau qhov Add New Constraints khawm (ib qho uas zoo li Star Wars khi sib ntaus), thiab tom qab ntawd nkag mus rau qhov siab thiab nias Enter.
3. Xaiv tag nrho peb ntu thiab muab tso rau hauv pawg saib los ntawm txhaj rau Embed In Stack khawm.
4. Tam sim no qhib Tus Pabcuam Editor, thiab nias CTRL thiab rub los ntawm txhua feem mus rau ViewController code, los tsim Outlets rau txhua feem.
@IBOutlet var imageView: UIImageView!
@IBOutlet var openLibraryButton: UIButton! @IBOutlet var openCameraButton: UIButton!
5. Tam sim no CTRL thiab luag los ntawm ob lub nyees khawm los tsim qhov Action los qhib lub koob yees duab/tsev qiv ntawv UI's.
6. Hauv qhov Qhib Qhib Qhib, ntxiv cov cai hauv qab no
@IBAction func openLibrary (_ sender: Txhua) {
cia imagePicker = UIImagePickerController () imagePicker.delegate = tus kheej; imagePicker.sourceType =.photoLibrary self.present (imagePicker, animated: tseeb, tiav: nil)}
7. Hauv Qhib Lub Koob Yees Duab ua
@IBAction func openCamera (_ tus xa: Txhua) {
cia imagePicker = UIImagePickerController () imagePicker.delegate = tus kheej imagePicker.sourceType =.camera; self.present (imagePicker, ua yeeb yaj kiab: muaj tseeb, ua tiav: nil)}
Kauj Ruam 5: Sau Huab Huab
Raws li cov duab tsis tas yuav khaws cia hauv huab mus ib txhis, peb tuaj yeem sau Huab Cua Ua Haujlwm los ua kev ntxuav. Qhov no tuaj yeem ua rau muaj kev ua haujlwm HTTP txhua teev los ntawm kev pabcuam cron xws li cron-job.org.
Ua ntej tshaj plaws peb yuav tsum teeb tsa firebase-cov cuab yeej
npm nruab -g firebase -tools
Tom qab ntawd los ntawm txoj haujlwm lub hauv paus phau ntawv teev npe
firebase pib
Xaiv cov haujlwm los ntawm kab hais kom ua rau pib ua haujlwm huab. Koj tseem tuaj yeem pab tua hluav taws yog tias koj xav tau kuj tseem xav teeb tsa Firestore.
Tom qab ntawd qhib cov haujlwm/index.js thiab ntxiv cov cai hauv qab no. Nco ntsoov hloov
rau koj qhov Firebase project id.
const functions = xav tau ('firebase-functions');
const admin = xav tau ('firebase-admin'); admin.initializeApp () export.cleanup = functions.https.onRequest ((thov, teb) => {admin.firestore ().collection ('uploads'). where ('timestamp', '{snapshot.forEach (doc = > {admin.storage ().bucket ('gs: //.appspot.com').file (doc.data ().key).delete () doc.ref.delete ()}) rov teb.status (200).send ('OK')}).catch (yuam kev => response.status (500). Xa (yuam kev))});
Kev xa tawm huab ua haujlwm yog yooj yim li khiav cov lus txib no.
firebase deploy
Tom qab ntawd ntawm cron-job.org tsim txoj haujlwm los ua kom muaj qhov kawg no txhua teev. Qhov kawg yuav yog ib yam zoo li
us-central1-project_id.cloudfunctions.net/cleanup
Kauj ruam 6: Khiav lub App
Khiav lub app ntawm tus simulation lossis ntaus ntawv iOS, thiab pib sib koom duab!
Pom zoo:
Cov Txheej Txheem Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: 12 Cov Kauj Ruam (nrog Duab)
Txoj Cai Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: Hauv lub tuam txhab uas kuv ua haujlwm muaj lub rooj ncaws pob. Lub tuam txhab nyob ntau cov plag tsev thiab rau qee tus neeg ua haujlwm nws yuav siv sijhawm li 3 feeb los txog ntawm lub rooj thiab … kom paub tias lub rooj twb nyob lawm
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: 5 Cov Kauj Ruam (nrog Duab)
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: Hauv Cov Lus Qhia no kuv qhia koj li cas kuv ntxiv kev siv tshuab rau kuv qhov muag tsis pom. Kuv xav kom muaj peev xwm ntxiv thiab tshem tawm qhov kev siv tshuab nws, yog li txhua qhov kev teeb tsa yog clip ntawm.Qhov tseem ceeb yog: Stepper motor Stepper tsav tswj bij ESP-01 Iav thiab teeb tsa
360 VR App hauv 10 feeb Nrog Kev Sib Koom: 8 Kauj Ruam
360 VR App hauv 10 feeb Nrog Kev Sib Koom: Peb tsim lub app no li cas? Yog li, thawj zaug peb yuav tsum tsim lub vijtsam kheej kheej los ua haujlwm peb 360 video rau. Tus neeg uas ua ntawv (lossis tus saib) yuav nyob hauv no sph
Tsim Curved UI hauv Kev Sib Koom rau Kev Muaj Tseeb Virtual: 4 Kauj Ruam
Tsim Cov Nkhaus UI hauv Kev Sib Koom rau Kev Muaj Tseeb Virtual: Yog tias koj tab tom nrhiav kev daws teeb meem dawb thiab yooj yim los tsim cov neeg siv nkhaus rau koj li Virtual Reality Application lossis VR Game koj ntawm qhov chaw raug. Hauv blog no koj yuav kawm tsim lub nkhaus ui keeb hauv kev sib koom siv Unity UI Extensions
Swarm Bots: Kev Sib Tham thiab Kev Koom Tes Thauj Mus Los: 13 Cov Kauj Ruam
Swarm Bots: Kev Sib Tham thiab Kev Koom Tes Nrog Kev Thauj Mus Los: Nyob zoo txhua tus, Cov lus qhia no yog hais txog 'Swarm Bots: Kev Sib Tham thiab Kev Koom Tes Koom Tes' uas peb tuaj yeem tsim peb tus kheej tus tswv thiab tus neeg hlau qhev, qhev yuav ua raws tus tswv neeg hlau thiab peb yuav tswj tus tswv neeg hlau nrog peb lub smartphone Nws yog qhov haujlwm lom zem