ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Mobile Application Development 2
    COMP4126
    Progress0 / 38 topics
    Topics
    1. Creating an iOS App: Understanding Xcode2. Using the Xcode interface builder and objects library3. Understanding view hierarchy and creating a custom app icon4. Outlets, Actions, and Views: Understanding outlets and actions5. Using text fields, buttons, labels, web views, and page controllers6. Using views with subviews and creating views using code7. Using View Controllers: Working with the single view template8. Exploring the app delegate and adding new view controllers9. Transitioning between multiple view controllers using animations10. Application Templates: Tabbar and master detail templates11. The iOS Keyboard: Customizing for different inputs12. Adjusting text field behaviors and dismissing the keyboard13. Detecting keyboard activities with notification center14. Using scroll view and responding to keyboard activities programmatically15. Working with Different iOS Devices (iPhone & iPad): Detecting device hardware16. Dynamically adjusting graphical layouts and creating universal apps17. Using Table Views: Understanding UITableView and UITableViewCell18. Working with UITableView data source and delegate19. Master detail template, drill-down menus, and navigation20. Using property lists for data persistence and creating multi-section tables21. Supporting Screen Rotations: Portrait and landscape modes22. Handling device rotation and forcing specific orientation23. Dynamically adjusting layouts based on rotation24. Working with Databases: Importing sqlite3 and creating a database25. Writing tables, inserting records, and bundling a database with your app26. Checking for database existence and reading/displaying data27. Using Animations & Video: NSTimer class and object transformations28. Rotation, scaling, translation, animating image arrays, and playing video29. Accessing Integrated iOS Apps: Email, Safari, and SMS30. Working with camera and photo library31. Using Web Services: Consuming and parsing XML and JSON32. Integrating Twitter and Facebook with iOS apps33. Working with iOS Maps and Location Services: MapKit and MKMapView34. Getting and displaying user location and directional information35. Displaying map annotations, disclosure buttons, and reverse geocoding36. Working with iCloud37. Working with the Accelerometer: Gyroscope and accelerometer38. Outputting sensor data and using the Shake API
    COMP4126›Accessing Integrated iOS Apps: Email, Safari, and SMS
    Mobile Application Development 2Topic 29 of 38

    Accessing Integrated iOS Apps: Email, Safari, and SMS

    3 minread
    481words
    Beginnerlevel

    📱 Accessing Integrated iOS Apps: Email, Safari, and SMS (iOS – Xcode)


    ✅ 1. Definition

    In iOS development, integrated apps access means allowing your app to open and interact with built-in iOS applications such as:

    • 📧 Mail (Email app)
    • 🌐 Safari (Web browser)
    • 💬 Messages (SMS app)

    👉 This is done using URL Schemes and system frameworks like UIKit.


    🧠 2. Key Concepts

    🔹 URL Scheme

    A special type of URL used to open system apps.

    Examples:

    • mailto: → Email
    • https:// → Safari
    • sms: → Messages

    🔹 UIApplication

    Used to open external apps from your app:

    UIApplication.shared.open(URL)
    

    📧 3. Opening Email App (Mail)


    🔹 Basic Email Format

    mailto:example@gmail.com
    

    🔹 Send Email with Subject & Body

    let email = "test@gmail.com"
    let subject = "Hello"
    let body = "This is a test email"
    
    let emailString = "mailto:\(email)?subject=\(subject)&body=\(body)"
    let url = URL(string: emailString)!
    
    UIApplication.shared.open(url)
    

    🌐 4. Opening Safari (Web Browser)


    🔹 Open Website

    let url = URL(string: "https://www.google.com")!
    UIApplication.shared.open(url)
    

    🔹 Why Safari is Used?

    • Display web pages
    • Open external links
    • Load online content

    💬 5. Sending SMS (Messages App)


    🔹 Basic SMS Format

    sms:1234567890
    

    🔹 Send SMS with Message Body

    let phoneNumber = "1234567890"
    let message = "Hello from my app"
    
    let smsString = "sms:\(phoneNumber)&body=\(message)"
    let url = URL(string: smsString)!
    
    UIApplication.shared.open(url)
    

    📊 6. Integration Flow Diagram

    iOS App
       ↓
    URL Scheme (mailto / https / sms)
       ↓
    UIApplication.shared.open()
       ↓
    System App Opens (Mail / Safari / Messages)
    

    💡 7. Example App

    🎯 Contact App

    • Button 1 → Send Email
    • Button 2 → Open Website
    • Button 3 → Send SMS

    👉 User taps button → system app opens automatically


    📌 8. Important Rules / Tips

    • Always validate URLs before opening
    • Use UIApplication.shared.open()
    • Encode spaces in URLs properly
    • Some features require real device testing (SMS)
    • Safari opens web content only with https://

    ⚠️ 9. Common Mistakes

    • ❌ Invalid URL format
    • ❌ Not encoding spaces in message
    • ❌ Testing SMS on simulator (won’t work)
    • ❌ Forgetting https:// in Safari links
    • ❌ Force unwrapping nil URLs

    🧠 10. Best Practices

    • Use URL encoding for safety
    • Check if device can open URL:
    if UIApplication.shared.canOpenURL(url) {
        UIApplication.shared.open(url)
    }
    
    • Keep message content short
    • Test on physical device for SMS/email

    📝 11. Likely Exam Questions

    1. What are integrated iOS apps?
    2. How do you open Safari from an iOS app?
    3. What is a URL scheme?
    4. Write code to send an email from an app.
    5. How do you send SMS in iOS?
    6. What is the use of UIApplication.shared.open()?
    7. Differentiate mail, SMS, and Safari integration.
    8. Why is SMS not working in simulator?

    📚 12. Quick Revision Summary

    • iOS apps can open:

      • 📧 Mail → mailto:
      • 🌐 Safari → https:
      • 💬 SMS → sms:
    • Uses UIApplication.shared.open()

    • URL schemes connect apps

    • Works best on real devices

    • Useful for communication apps


    Previous topic 28
    Rotation, scaling, translation, animating image arrays, and playing video
    Next topic 30
    Working with camera and photo library

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time3 min
      Word count481
      Code examples0
      DifficultyBeginner