Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

plugin update failed
Started by mirzafahad12 Jun 10 2019 02:51 AM

8 replies to this topic
microphonepower plugin update plugin not found plugin update failed
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mirzafahad12

[GLOBAL: userInfoPane.html]
mirzafahad12
  • Observer

  • 8 posts
  • Corona SDK

Hi 

 

Hi

I have build a plugin regarding microphone power. It's was working fine for version 1. some days ago i added new methods in plugin and push and update for plugin and it broke everything. After the update when i require my plugin it crashes at the very start of the app says plugin not found. When i test my plugin locally on Xcode project it works fine but on update it does not work at all. It seems like there is something wrong with my '.a' file. Can anyone please help me with this. How can i test my '.a' file. I want to test my '.a' file before pushing an update of plugin. Is there a way i can test it and see what's inside the '.a' file. 

Thanks



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,331 posts
  • Enterprise

Is this post by you? It seems to be an exact copy.

 

Rob



[TOPIC: post.html]
#3

mirzafahad12

[GLOBAL: userInfoPane.html]
mirzafahad12
  • Observer

  • 8 posts
  • Corona SDK

Yes it's by me. The other post was also by me but i thought that was not published that's why i post it from this account.

Any solution regarding my issue.



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,331 posts
  • Enterprise

Please only post once.

 

When did it break? Do you have your source in source control that you can roll back to a previous version?

 

Rob



[TOPIC: post.html]
#5

mirzafahad12

[GLOBAL: userInfoPane.html]
mirzafahad12
  • Observer

  • 8 posts
  • Corona SDK

When i push the update for my plugin then it stops working. I needed to add new functions in my plugin and after i added new functions and make new '.a' file and uploaded the new '.a' file on repo then my plugin failed to response. It starts crashing on start of app and saying plugin not found. 

 

I think the issue is with my new '.a' file i tried to look into '.a' file but it seems we can not see what's inside that file. Can you please look into it and see what's the issue with it.

yes i can roll back to my previous version and the previous version is working fine. 
 



[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,331 posts
  • Enterprise

I can't look into a .a file any more than you can. Can you post your specific changes you're making?

 

Rob



[TOPIC: post.html]
#7

mirzafahad12

[GLOBAL: userInfoPane.html]
mirzafahad12
  • Observer

  • 8 posts
  • Corona SDK


#import "PluginMicrophonePower.h"

#include <CoronaRuntime.h>
#import <UIKit/UIKit.h>

// ----------------------------------------------------------------------------

class microphonePower
{
public:
    typedef microphonePower Self;
    
public:
    static const char kName[];
    static const char kEvent[];
    
protected:
    microphonePower();
    
public:
    bool Initialize( CoronaLuaRef listener );
    
public:
    CoronaLuaRef GetListener() const { return fListener; }
    
public:
    static int Open( lua_State *L );
    
protected:
    static int Finalizer( lua_State *L );
    
public:
    static Self *ToLibrary( lua_State *L );
    
public:
    static int init( lua_State *L );
    static int getPower( lua_State *L );
    static int startRecording( lua_State *L );
    static int stopRecording( lua_State *L );
    static int startSession( lua_State *L );
    
private:
    CoronaLuaRef fListener;
};

// ----------------------------------------------------------------------------

// This corresponds to the name of the library, e.g. [Lua] require "plugin.library"
const char microphonePower::kName[] = "plugin.microphonePower";

// This corresponds to the event name, e.g. [Lua] event.name
const char microphonePower::kEvent[] = "power";

FrequencyCheck *frequecyCheck;

microphonePower::microphonePower()
:    fListener( NULL )
{
}

bool
microphonePower::Initialize( CoronaLuaRef listener )
{
    // Can only initialize listener once
    bool result = ( NULL == fListener );
    
    if ( result )
    {
        fListener = listener;
    }
    
    return result;
}

int
microphonePower::Open( lua_State *L )
{
    // Register __gc callback
    const char kMetatableName[] = __FILE__; // Globally unique string to prevent collision
    CoronaLuaInitializeGCMetatable( L, kMetatableName, Finalizer );
    
    // Functions in library
    const luaL_Reg kVTable[] =
    {
        { "init", init },
        { "getPower", getPower },
        { "startRecording", startRecording },
        { "stopRecording", stopRecording },
        { "startSession", startSession },
        { NULL, NULL }
    };
    
    // Set library as upvalue for each library function
    Self *library = new Self;
    CoronaLuaPushUserdata( L, library, kMetatableName );
    
    luaL_openlib( L, kName, kVTable, 1 ); // leave "library" on top of stack
    
    return 1;
}

int
microphonePower::Finalizer( lua_State *L )
{
    Self *library = (Self *)CoronaLuaToUserdata( L, 1 );
    
    CoronaLuaDeleteRef( L, library->GetListener() );
    
    delete library;
    
    return 0;
}

microphonePower *
microphonePower::ToLibrary( lua_State *L )
{
    // library is pushed as part of the closure
    Self *library = (Self *)CoronaLuaToUserdata( L, lua_upvalueindex( 1 ) );
    return library;
}

int
microphonePower::init( lua_State *L ) {
    frequecyCheck = [[FrequencyCheck alloc] init];
    const char *word = lua_tostring(L, 1);
    NSString *filename = [NSString stringWithUTF8String:word];
    [frequecyCheck createRecorder:filename];
    
    int listenerIndex = 2;
    
    if ( CoronaLuaIsListener( L, listenerIndex, kEvent ) )
    {
        Self *library = ToLibrary( L );
        
        CoronaLuaRef listener = CoronaLuaNewRef( L, listenerIndex );
        library->Initialize( listener );
    }
    
    return 0;
}

// [Lua] library.show( word )
int
microphonePower::getPower( lua_State *L )
{
    //    NSLog(@"Mic blow detected, %f", [frequecyCheck checkFrequency]);
    double frequencyValue = [frequecyCheck checkFrequency]*100;
    
    Self *library = ToLibrary( L );
    
    // Create event and add message to it
    CoronaLuaNewEvent( L, kEvent );
    lua_pushnumber( L, frequencyValue );
    lua_setfield( L, -2, "value" );
    
    // Dispatch event to library's listener
    CoronaLuaDispatchEvent( L, library->GetListener(), 0 );
    return 0;
}
int
microphonePower::startRecording( lua_State *L )
{
    [frequecyCheck startRecording];
    return 0;
}
int
microphonePower::stopRecording( lua_State *L )
{
    [frequecyCheck stopRecording];
    return 0;
}
int
microphonePower::startSession( lua_State *L )
{
    [frequecyCheck startSession];
    return 0;
}


// ----------------------------------------------------------------------------

CORONA_EXPORT int luaopen_plugin_microphonePower( lua_State *L )
{
    return microphonePower::Open( L );
}

Here is my 'PluginMicrophonePower.mm' but i think issue is not within this issue. Issue is in '.a' maybe when i am making '.a' i am missing something. How can i detect my issue with '.a' file. Can i see into my '.a' file?



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,331 posts
  • Enterprise

What did you add that started the plugin to break?



[TOPIC: post.html]
#9

mirzafahad12

[GLOBAL: userInfoPane.html]
mirzafahad12
  • Observer

  • 8 posts
  • Corona SDK

int
microphonePower::startRecording( lua_State *L )
{
    [frequecyCheck startRecording];
    return 0;
}
int
microphonePower::stopRecording( lua_State *L )
{
    [frequecyCheck stopRecording];
    return 0;
}
int
microphonePower::startSession( lua_State *L )
{
    [frequecyCheck startSession];
    return 0;
}

I have added these three new methods in it.




[topic_controls]
[/topic_controls]