Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<1주차> 앱이 foreground에 있을 때와 background에 있을 때 어떤 제약사항이 있나요? #3

Closed
5anniversary opened this issue Oct 30, 2020 · 6 comments

Comments

@5anniversary
Copy link
Collaborator

No description provided.

@namsoo5
Copy link
Collaborator

namsoo5 commented Nov 3, 2020

제약사항

  • 사용자의 이벤트를 받을 수 없다
  • 리소스 사용순위가 밀리고, 메모리 사용에 제한 - 메모리가 모자랄시 언제든지 종료 될 가능성이 있다
  • 시간 제약 - 10분정도의 시간동안 앱이 죽지않고 있을 수 있다
    (beginBackgroundTaskWithName:expirationHandler:)
    (beginBackgroundTaskWithExpirationHandler:)을 사용해서 추가적으로 사용 할 수도 있지만
    그 이상을 사용하려면 따로 권한을 등록 해야한다

아래와같은 경우 권한을 추가해서 사용할 수 있다.

  • APNS
  • Local Notification
  • Location
  • Audio
  • VoIP
  • BlueTooth
    -> 콘텐츠 재생 앱, 네비게이션, 백그라운드 오디오기록, VoIP지원 앱, 백그라운드 다운로드앱, 블루투스 앱

@namsoo5 namsoo5 added the 남수 label Nov 3, 2020
@iJoom
Copy link
Collaborator

iJoom commented Nov 5, 2020

foreground에선, 유저의 행동 우선순위가 시스템 리소스, CPU 보다 높다.
Back ground
Audio, AirPlay, PIP Location, Newsstand, iOS Based 외부 악세사리, Bluetooth, PushNotification, BackgroundFetch 등의 기능 사용가능 ** Audio 권한 사용시 주의 ** 음악앱이 아니면, 앱스토어 심사에서 리젝을 받을 수 있다. 음악앱이 아니면 제약사항으로도 볼 수 있다.
Background Fetch 설정도 가능
사용자의 앱 사용 패턴을 익혀서, 해당앱이 사용할 시간이 되면 미리 앱을 application(_:performFetchWithCompletionHandler:)메소드를 통해서 깨워 놓는다.

백그라운드에서 통신할때의 전송 제한사항

백그라운드 세션에서 실제 전송은 앱의 프로세스와 다른 개인 프로세스에 의해 수행. 앱의 프로세스를 다시 시작하는 데 비용이 많이 들기 때문에 몇 가지 기능을 사용할 수 없어 다음과 같은 제한이 있습니다.

세션은 이벤트 전달을위한 delegate를 사용한다. (업로드 및 다운로드의 경우 델리게이트는 진행중인 전송과 동일하게 작동)
HTTP 및 HTTPS 프로토콜 만 지원됩니다 (사용자 지정 프로토콜 없음).
리디렉션은 항상 따릅니다. 결과적으로 urlSession (_ : task : willPerformHTTPRedirection : newRequest : completionHandler :)를 구현 했더라도 호출되지 않습니다.

@iJoom iJoom added the 인준 label Nov 5, 2020
@5anniversary
Copy link
Collaborator Author

background task의 제약사항

  • task의 실행 지속시간이 10분을 넘기지 못합니다. ( 10분이 넘는 순간 suspend로 넘어갑니다. )
  • UIKit Framework를 실행시킬수없습니다.
  • 다른 task의 우선순위보다 밀리게 됩니다.

background 에서 사용이 가능한 기능은

  • Audio
  • AirPlay
  • Picture in Picture (PIP)
  • Location updates
  • Remote notifications
  • Background fetch
    가 있습니다. (이런 기능을 이용해 꼼수로 백그라운드로 앱의 기능을 사용하는 어플들이 있다고,,, 합니다? ex. 알림 앱)

Background fetch의 경우에는

앱을 자주 사용하는 시간을 파악해 그 특정 시간에 Appdelegate 내의 메소드인
application(_:performFetchWithCompletionHandler:)를 사용해 원하는 메소드를 실행시킬 수 있습니다.

@khyunjiee
Copy link
Member

Foreground : 이벤트가 리소스보다 우선순위가 높다

Background에서의 제한

  • 사용자의 이벤트를 수신하지 못한다.
  • 리소스 사용 우선순위가 밀리고, 메모리가 부족하다면 특별한 알림 없이 앱이 종료될 수 있다.
    이후 앱을 실행하면 이전 상태의 화면이 나오지 않고 재시작된다.

Background Modes

  • Background 상태에서 App을 시작하거나 다시 시작하여 이벤트를 처리할 수 있도록 지원해준다.
  • Audio, Location, Newsstand, iOS Based 외부 악세사리, Bluetooth, PushNotification, BackgroundFetch 등 의 기능들을
    Background 상태에서도 동작할 수 있도록 해준다
  • Xcode Capabilities에서 설정 가능하다

@choidam
Copy link
Member

choidam commented Nov 6, 2020

background 제약 사항

  • 일정한 시간에 호출되지 않습니다. (시스템에서 판단했을 때 배터리, 메모리 상황이 괜찮을 때, 그리고 사용자가 이 앱을 언제 보통 켜는지 학습해 그 전에 호출함 = 알 수 없음)
  • 유저가 일주일 동안 앱을 켜지 않으면 더 이상 Background Fetch가 실행되지 않습니다.

background 에서 사용 가능한 기능

  • Audio, Airplay, Picture
  • Location updates
  • Remote notifiacation
  • Background Fetch

@choidam choidam added the label Nov 6, 2020
@elesahich
Copy link
Collaborator

@elesahich elesahich added the 승호 승호 label Nov 6, 2020
@namsoo5 namsoo5 closed this as completed Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants