iOS 5.1을 사용하여 환경 설정 / 설정을 여는 방법은 무엇입니까?
-
09-12-2019 - |
문제
iOS 5.1이 사용자를 선호하는 사용자를 탐색하기위한 표준 URL 인코딩을 끊었습니다.
예 :
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=TWITTER"]];
.
은 iOS 5.0에서 작동하지만 iOS 5.1 (장치 및 시뮬레이터 모두).
누구나 iOS 5.1 에서이 기능을 복제하는 방법을 찾았습니까?
해결책
아니오이 기능을 복제하는 방법을 모르겠습니다.
그러나 할 수있는 일은 복원을 요청하는 레이더가 파일입니다. Schemes가 처음으로 문서화되어 있음을 요청하는 레이더
데이비드 바 나드 는 iOS 5.1을 확인했습니다. 설정 응용 프로그램 URL 구성표를 해제합니다.
update : iOS 8은 앱 설정을 열 수있는 비슷한 기능을 가지고 있습니다. 감사합니다 Apple, Mike 및 soto_ighost .
상수 UIApplicationOpenSettingsURLString
(UIApplication Documentation) 앱의 설정을 열고 Twitter의 설정을 말할 수 없습니다. 정확히 동일한 기능이 아니라 이전보다 훨씬 청결한 것이 아니라 현재 공식적으로 인식됩니다.
이제는 각 앱이 개인 정보, 셀룰러 데이터, 배경 앱 앱 새로 고침 및 알림을 사용하기위한 설정에있는 설정이 필요합니다.
다른 팁
Tricky는 거의 없으며, *TWTWeetComposeViewController*
에서 하위보기를 제거하면 사용자가 로그인하지 않고 설정 버튼을 클릭하면 내 앱에서 설정 페이지를 열 수 있습니다.
+ (void)setAlertForSettingPage :(id)delegate
{
// Set up the built-in twitter composition view controller.
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
// Create the completion handler block.
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
[delegate dismissModalViewControllerAnimated:YES];
}];
// Present the tweet composition view controller modally.
[delegate presentModalViewController:tweetViewController animated:YES];
//tweetViewController.view.hidden = YES;
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
}
.
여기서는 viewController 에서이 메서드를 사용하는 경우 viewController입니다. self
대신 delegate
를 사용하십시오.
편집 : 더 이상 사용되지 않는 오류가 발생하면 대신 다음 iOS6 호환 코드를 사용하십시오.
.- (void)setAlertForSettingPage
{
// Set up the built-in twitter composition view controller.
SLComposeViewController *tweetViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
// Present the tweet composition view controller modally.
[self presentViewController:tweetViewController animated:YES completion:nil];
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
}
이 작업을 수행 할 수 있습니다.
TWTweetComposeViewController *ctrl = [[TWTweetComposeViewController alloc] init];
if ([ctrl respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) {
// Manually invoke the alert view button handler
[(id <UIAlertViewDelegate>)ctrl alertView:nil
clickedButtonAtIndex:0];
}
. 트위터의 프레임 워크 (Twitter View Controller)를 보면 "prefs : root= Twitter"가 있습니다. 5.1에는이 줄이 있습니다.그래서 Apple은 Plist 또는 Method의 특별한 키와 마찬가지로 다른 앱을 사용하여 다른 앱으로 비활성화 할 것을 만들었습니다. "OpenURL"이 아닌 경우 어떻게든지 확인합니다.