NSStatusItem doesn't work in fullscreen mode starting 10.13 - ios

Very simple application. When any other application is in fullscreen mode my apps system tray drop down menu doesn't show up. Other application like system time's drop down shows up properly.
No app in fullscreen
Xcode app in full screen (icon is clicked but drop down is not shown)
Here is my code ->
NSStatusItem *g;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
statusItem.menu = [[NSMenu alloc] init];
NSMenuItem *test = [[NSMenuItem alloc] init];
test.title = #"Just a test";
[statusItem.menu addItem:test];
NSImage *img = [NSImage imageNamed:#"icon.icns"];
[img setSize:NSMakeSize(18.0, 18.0)];
statusItem.image = img;
g = statusItem;
}

Related

I can't see my siri shortcuts on lock screen using NSUserActivity

I add on the info.plist my strings with the tag NSUserActivityTypes.
I add this piece of code on the viewDidload method of the screen:
NSUserActivity *userActivityTag = [[NSUserActivity alloc] initWithActivityType:kVoucher];
if(#available(iOS 12.0, *)) {
[userActivityTag setEligibleForPrediction:YES];
userActivityTag.suggestedInvocationPhrase = [NSString stringWithFormat:#"Let's Voucher this"];
}
[userActivityTag setEligibleForSearch:YES];
[userActivityTag setRequiredUserInfoKeys:nil];
userActivityTag.title = [NSString stringWithFormat:#"Voucher"];
userActivityTag.userInfo = #{
#"value":#"key"
};
UIImage *logo = [UIImage imageNamed:#"someImage"];
NSData *logoNSData = UIImageJPEGRepresentation(logo, 1.0f);
CSSearchableItemAttributeSet *attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType: (NSString *)kUTTypeItem];
attributes.title = #"title";
attributes.keywords = #[#"implement", #"something", #"lol"];
attributes.contentDescription = #"Subtitle";
attributes.thumbnailData = logoNSData;
attributes.domainIdentifier = #"ownID";
userActivityTag.contentAttributeSet = attributes;
[userActivityTag becomeCurrent];
After that I go to that screen and puts a breakpoint in order to probe that the code was executed.
I switch on both options on Settings -> Developer -> Display recent Shortcuts and Display donations on Lock Screen.
On my AppDelegate I had this:
if([userActivity.activityType isEqualToString:kVoucher]) {
// Restore state for userActivity and userINFO
}
So, the question is: Why, I canĀ“t see my shortcut on the lockscreen?
Any help please!
Are you able to see it when you unlock the phone and go to siri suggestion screen?
Try setting this activity to your current view controller.
[self setUserActivity: userActivityTag]
Don't know it will help or not but its working for me.

How to change home screen for Jailbreak Device programming

I'm a newbie in iOSOpenDev. I want to change the home screen on my jailbroken device. I use iOSOpenDev with Logos tweak to implement this
%hook SBUIController
- (void)finishLaunching
{
SBUIController *uicontroller = (SBUIController *)[%c(SBUIController) sharedInstance];
// Get _contentView & _iconsView from SBUIController
UIView* _contentView = [uicontroller valueForKey:#"_contentView"];
UIView* _iconsView = [uicontroller valueForKey:#"_iconsView"];
// Hidden _iconsView
_iconsView.hidden = YES;
// Add Sphere View
SphereViewManager *sphere = [[SphereViewManager alloc] initWithFrame:[UIScreen mainScreen].bounds];
sphere.frame = [UIScreen mainScreen].bounds;
sphere.tag = 20141201;
[_contentView addSubview:sphere];
}
After SpringBoard is restarted, my home screen is loaded. But when I tap an app to launch, and then I press the HOME button, my device returns to the old home screen. How do I prevent my HOME screen from returning the the old view?

iOS esri sdk - Multiple Popups using AGSPopupsContainerViewController

I am using AGSPopupsContainerViewController to display multiple popups when touching on mapView we fetch more than one AGSGraphics.
Here is my code:
NSMutableArray *popups =[[NSMutableArray alloc]init];
AGSPopupInfo *popupinfo;
for (AGSGraphic *g in Graphics ) {
popupinfo =[AGSPopupInfo popupInfoForGraphic:g] ;
AGSPopup* popup = [AGSPopup popupWithGraphic:g popupInfo:popupinfo];
popup.allowEditGeometry = false;
[popups addObject:popup];
}
if (!popupVC) {
self.popupVC = [[AGSPopupsContainerViewController alloc] initWithPopups:popups
usingNavigationControllerStack:false];
}else{
[self.popupVC showAdditionalPopups:popups];
}
self.popupVC.delegate = self;
self.popupVC.doneButton = self.customActionButton;
self.popupVC.style = AGSPopupsContainerStyleCustomColor;
self.popupVC.barItemTintColor = [UIColor redColor];
self.popupVC.pagingStyle = AGSPopupsContainerPagingStyleToolbar;
// Animate by flipping horizontally
self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// If iPad, use a modal presentation style
if([[AGSDevice currentDevice] isIPad])
self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:self.popupVC animated:YES completion:nil];
All works fine, I have the right number of pupups, the problem is that using the arrows in the toolbar I can only see the first and the last ones. Why? I am missing something?
Arrows are doing what they are supposed to do - using them will show you the first and the last popup. Swipe to the left (or right) and you'll see the rest of the popups.

inAppbrowser done button text change

in my phonegap iOS app, i m using cordova2.7.0 and using inAppwebbrowser, when it opens done button coming to bottom, i need to chnge text of 'Done' to french name, so please tell me.
Thanks
You can do it by native in Xcode ,in phonegap currently can't do it, customizing 'Done' button text is a feature that the Phonegap team is working on. You can read more about it here.
how in xcode:
Locate CDVInAppBrowser.m as shown
coredovalib -> classes -> commands -> CDVInAppBrowser.m
and paste below code snippet where close button properties are set
self.closeButton = [[UIBarButtonItem alloc] initWithTitle:#"my text"
style:UIBarButtonItemStyleBordered target:self action:#selector(close)];
Try this
On CDVInAppBrowser.m file replace
Replace this
if (browserOptions.closebuttoncaption != nil) {
[self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
}
to
if (browserOptions.closebuttoncaption == nil) {
NSLog(#"hiii if");
[self.inAppBrowserViewController setCloseButtonTitle:#"Your French Name hear"];
}
Open ${projectname}/plugins/org.apache.cordova.inappbrowser/src/ios/CDVInAppBrowser.m with an editor of your choice.
in the init function, look for this:
self.toolbar = YES;
self.closebuttoncaption = nil;
self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
self.clearcache = NO;
self.clearsessioncache = NO;
Change
self.closebuttoncaption = nil; => self.closebuttoncaption = #"your text";
The Main advantage here is that it builds correct and you don't have to change it every time you build.
Also it is recommend to change the text in the init function, so don't have to change it in the setter function.
P.S.: Im using org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
In Cordova InAppBrowser 1.7.0 you can supply the close button text as closebuttoncaption when calling the InAppBrowser rather than having to change the code of Cordova:
myIAB.create('http:/blah, '_blank', 'location=no,closebuttoncaption=Close');
And also in window.open:
window.open('http://blah','_blank','location=no,closebuttoncaption=Close');
Other browserOptions listed in CDVInAppBrowserOptions with the defaults:
location = YES;
toolbar = YES;
closebuttoncaption = nil;
toolbarposition = kInAppBrowserToolbarBarPositionBottom;
clearcache = NO;
clearsessioncache = NO;
enableviewportscale = NO;
mediaplaybackrequiresuseraction = NO;
allowinlinemediaplayback = NO;
keyboarddisplayrequiresuseraction = YES;
suppressesincrementalrendering = NO;
hidden = NO;
disallowoverscroll = NO;

Open Game Center UI with Cocos2d-x

I have set up so that my app can connect to the Game Center. I followed this guide and had a C++ class wrapper to call them in my other classes. I'm using iPad (iOS 5.1), iPod Touch 4th Gen (iOS 5.1), and iPhone 4s and 3GS to test. It works fine on iPad devices but for some unknown reason, it does not on iPhone and iPod. It properly connects to the Sandbox but the UI is not shown, or rather, the UI is somewhere off-screen.
What happens on the iPhone is:
If I'm not logged in and I access the Game Center, a login window appears. When I log in, nothing happens. However, the console says a view is added.
If I'm logged in and I access the Game Center, nothing happens. However, the console says a view is added.
If I access the Game Center before I get authenticated, the Game Center UI appears. However...
The Game Center is in Landscape Mode (no problem there, since my app is in landscape) but the top bar (the bar with the DONE button) is placed as if the orientation is portrait.
The whole UI is not shown, just ~30% of the screen.
This is how I launch the Game Center UI:
- (void)showLeaderboardForCategory:(NSString *)category
{
// Only execute if OS supports Game Center & player is logged in
if ( hasGameCenter )
{
// Create leaderboard view w/ default Game Center style
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
// If view controller was successfully created...
if (leaderboardController != nil)
{
// Leaderboard config
leaderboardController.leaderboardDelegate = self; // The leaderboard view controller will send messages to this object
leaderboardController.category = category; // Set category here
leaderboardController.timeScope = GKLeaderboardTimeScopeToday; // GKLeaderboardTimeScopeToday, GKLeaderboardTimeScopeWeek, GKLeaderboardTimeScopeAllTime
// Create an additional UIViewController to attach the GKLeaderboardViewController to
myViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil ];
// Add the temporary UIViewController to the main OpenGL view
// NOTE: This is the part that I think is the suspect. I am not sure if iPhones and iPods support EAGLView.
[ [ EAGLView sharedEGLView ] addSubview:myViewController.view ];
// Tell UIViewController to present the leaderboard
[ myViewController presentModalViewController:leaderboardController animated:NO ];
NSLog( #"Leaderboard opened." );
}
}
}
Any help is appreciated and thanks in advance.
EDIT: Using OpenFeint is not an option.
Try this.Do not use 'EAGLView'
- (void) showLeaderboard
{
if (!gameCenterAvailable) return;
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil) {
leaderboardController.leaderboardDelegate = self;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
currentModalViewController = [[UIViewController alloc] init];
[window addSubview:currentModalViewController.view];
[currentModalViewController presentModalViewController:leaderboardController animated:YES];
}
}

Resources