react-native-orientation icon indicating copy to clipboard operation
react-native-orientation copied to clipboard

Use of private API

Open LeoNatan opened this issue 7 years ago • 5 comments

This framework uses private API.

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationLandscapeRight] forKey:@"orientation"];

This is the equivalent of calling setOrientation: which is private. On top of the bad user experience, this risks apps being rejected from the App Store.

LeoNatan avatar Dec 04 '17 14:12 LeoNatan

@LeoNatan can you provide some documentation on that if you have a source? Thanks

andrerfneves avatar Dec 04 '17 15:12 andrerfneves

I’m not sure what documentation you want.

Look at UIDevice documentation: https://developer.apple.com/documentation/uikit/uidevice/1620053-orientation?language=objc

Officially the orientation property is read-only. Any attempt to set it is private API.

LeoNatan avatar Dec 04 '17 15:12 LeoNatan

Hmm, I've managed to get accepted for our past 5 or so versions. Are there alternatives to this?

Naoto-Ida avatar Dec 05 '17 09:12 Naoto-Ida

That’s not an indication that Apple won’t block your app in the future. -[UIDevice setOrientation:] has been known to cause app rejections in the past. Look for that in Stack Overflow.

The correct way to achieve this on iOS is to use a UIViewController and control orientation from there. That’s a little challenging with RN but not impossible.

LeoNatan avatar Dec 05 '17 14:12 LeoNatan

Hi, any news about this? I see that this issue is still open

Ilario17 avatar Mar 23 '19 14:03 Ilario17